Throw lua error instead of assert

This commit is contained in:
Rochet2
2017-07-19 20:25:10 +03:00
parent 0cba9fc4c3
commit 481a605c5c

View File

@@ -1075,7 +1075,12 @@ int Eluna::Register(lua_State* L, uint8 regtype, uint32 entry, uint64 guid, uint
}
else
{
ASSERT(guid != 0);
if (guid == 0)
{
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
luaL_error(L, "guid was 0!");
return 0; // Stack: (empty)
}
auto key = UniqueObjectKey<Hooks::CreatureEvents>((Hooks::CreatureEvents)event_id, guid, instanceId);
bindingID = CreatureUniqueBindings->Insert(key, functionRef, shots);