Skip to content

Commit 7499ebe

Browse files
ZughyZughy
and
Zughy
authoredOct 13, 2020
Fix float argument check in minetest.set_timeofday() (#10483)
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
1 parent 2ca81d6 commit 7499ebe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

Diff for: ‎src/script/lua_api/l_env.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,9 @@ int ModApiEnvMod::l_set_timeofday(lua_State *L)
751751

752752
// Do it
753753
float timeofday_f = readParam<float>(L, 1);
754-
sanity_check(timeofday_f >= 0.0 && timeofday_f <= 1.0);
755-
int timeofday_mh = (int)(timeofday_f * 24000.0);
754+
luaL_argcheck(L, timeofday_f >= 0.0f && timeofday_f <= 1.0f, 1,
755+
"value must be between 0 and 1");
756+
int timeofday_mh = (int)(timeofday_f * 24000.0f);
756757
// This should be set directly in the environment but currently
757758
// such changes aren't immediately sent to the clients, so call
758759
// the server instead.

0 commit comments

Comments
 (0)
Please sign in to comment.