Check that LuaEntitySAO::setVelocity is not NaN
This commit is contained in:
parent
9269a0ecc7
commit
1fcea9112b
@ -617,6 +617,9 @@ void LuaEntitySAO::notifyObjectPropertiesModified()
|
|||||||
|
|
||||||
void LuaEntitySAO::setVelocity(v3f velocity)
|
void LuaEntitySAO::setVelocity(v3f velocity)
|
||||||
{
|
{
|
||||||
|
if(util_isnan(velocity.X) || util_isnan(velocity.Y) ||
|
||||||
|
util_isnan(velocity.Z))
|
||||||
|
throw BaseException("LuaEntitySAO::setVelocity(): Given value is NaN");
|
||||||
m_velocity = velocity;
|
m_velocity = velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +179,12 @@ v3f check_v3f(lua_State *L, int index)
|
|||||||
CHECK_POS_COORD("z");
|
CHECK_POS_COORD("z");
|
||||||
pos.Z = lua_tonumber(L, -1);
|
pos.Z = lua_tonumber(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
if(util_isnan(pos.X))
|
||||||
|
throw LuaError("NaN passed as X coordinate");
|
||||||
|
if(util_isnan(pos.Y))
|
||||||
|
throw LuaError("NaN passed as Y coordinate");
|
||||||
|
if(util_isnan(pos.Z))
|
||||||
|
throw LuaError("NaN passed as Z coordinate");
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,4 +416,6 @@ inline u32 npot2(u32 orig) {
|
|||||||
return orig + 1;
|
return orig + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define util_isnan(a) (!((a)==(a)))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user