From 481a605c5c338f2240eaea5b6e08ec4506e9d4be Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Wed, 19 Jul 2017 20:25:10 +0300 Subject: [PATCH] Throw lua error instead of assert --- LuaEngine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LuaEngine.cpp b/LuaEngine.cpp index 75c12f9..1131c3d 100644 --- a/LuaEngine.cpp +++ b/LuaEngine.cpp @@ -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)event_id, guid, instanceId); bindingID = CreatureUniqueBindings->Insert(key, functionRef, shots);