aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2018-05-31 22:52:08 +0200
committerGitHub <noreply@github.com>2018-05-31 22:52:08 +0200
commit162ffd7fba9d4e79a29f65686f3efbebaee9cee8 (patch)
treed58d2329f223eb991b4c39c7cfce209c46edc284 /src/script/lua_api/l_object.cpp
parentdf991edaa8617730f4ad15648e9131325a0fe2e8 (diff)
downloadminetest-162ffd7fba9d4e79a29f65686f3efbebaee9cee8.tar.xz
Fix isNan on setYaw Lua call (#7380)
* Fix isNan on setYaw Lua call
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index b3c3a55bf..8377f95c8 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -895,6 +895,9 @@ int ObjectRef::l_set_yaw(lua_State *L)
ObjectRef *ref = checkobject(L, 1);
LuaEntitySAO *co = getluaobject(ref);
if (co == NULL) return 0;
+ if (isNaN(L, 2))
+ throw LuaError("ObjectRef::set_yaw: NaN value is not allowed.");
+
float yaw = luaL_checknumber(L, 2) * core::RADTODEG;
// Do it
co->setYaw(yaw);