diff --git a/modules/game_containers/containers.lua b/modules/game_containers/containers.lua index 61c9c4fa..59698924 100644 --- a/modules/game_containers/containers.lua +++ b/modules/game_containers/containers.lua @@ -98,6 +98,7 @@ function Containers.onContainerUpdateItem(containerId, slot, item) local itemWidget = container:getChildByIndex(slot + 1) if not itemWidget then return end itemWidget:setItem(item) + item:setPos(itemWidget.position) end function Containers.onContainerRemoveItem(containerId, slot) diff --git a/src/otclient/core/game.cpp b/src/otclient/core/game.cpp index cbc6d166..f75858fa 100644 --- a/src/otclient/core/game.cpp +++ b/src/otclient/core/game.cpp @@ -369,7 +369,12 @@ int Game::getThingStackpos(const ThingPtr& thing) // thing is at map if(thing->getPos().x != 65535) { TilePtr tile = g_map.getTile(thing->getPos()); - return tile->getThingStackpos(thing); + if(tile) + return tile->getThingStackpos(thing); + else { + logError("could not get tile"); + return -1; + } } // thing is at container or inventory