Skip to content

Commit

Permalink
Check userdata pointer in Loot:addChildLoot (#4558)
Browse files Browse the repository at this point in the history
  • Loading branch information
MillhioreBT authored Nov 3, 2023
1 parent 6e3e689 commit a904904
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15248,7 +15248,13 @@ int LuaScriptInterface::luaLootAddChildLoot(lua_State* L)
// loot:addChildLoot(loot)
Loot* loot = getUserdata<Loot>(L, 1);
if (loot) {
loot->lootBlock.childLoot.push_back(getUserdata<Loot>(L, 2)->lootBlock);
Loot* childLoot = getUserdata<Loot>(L, 2);
if (childLoot) {
loot->lootBlock.childLoot.push_back(childLoot->lootBlock);
pushBoolean(L, true);
} else {
pushBoolean(L, false);
}
} else {
lua_pushnil(L);
}
Expand Down

0 comments on commit a904904

Please sign in to comment.