mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 13:34:58 +00:00
luaapi: Fix assertion error on invalid callback
previousl this would assert in luaW_callwidgetcallback
This commit is contained in:
parent
81145470c3
commit
9f51db3e47
@ -285,6 +285,9 @@ static int intf_set_dialog_callback(lua_State* L)
|
||||
if(!wd) {
|
||||
throw std::invalid_argument("the widget has no window assigned");
|
||||
}
|
||||
if(!lua_isfunction(L, 2)) {
|
||||
return luaL_argerror(L, 2, "callback must be a function");
|
||||
}
|
||||
|
||||
lua_pushvalue(L, 2);
|
||||
bool already_exists = luaW_setwidgetcallback(L, w, wd, "callback");
|
||||
|
Loading…
x
Reference in New Issue
Block a user