fix possible crash when trading and using containers

This commit is contained in:
Eduardo Bart 2012-04-27 04:28:06 -03:00
parent b1e5fdc9ae
commit 7b81a0cf3b
1 changed files with 3 additions and 3 deletions

View File

@ -617,7 +617,7 @@ void Game::open(const ItemPtr& item, const ContainerPtr& previousContainer)
void Game::openParent(const ContainerPtr& container)
{
if(!canPerformGameAction())
if(!canPerformGameAction() || !container)
return;
m_protocolGame->sendUpContainer(container->getId());
@ -625,7 +625,7 @@ void Game::openParent(const ContainerPtr& container)
void Game::close(const ContainerPtr& container)
{
if(!canPerformGameAction())
if(!canPerformGameAction() || !container)
return;
m_protocolGame->sendCloseContainer(container->getId());
@ -879,7 +879,7 @@ void Game::closeNpcTrade()
void Game::requestTrade(const ItemPtr& item, const CreaturePtr& creature)
{
if(!canPerformGameAction())
if(!canPerformGameAction() || !item || !creature)
return;
m_protocolGame->sendRequestTrade(item->getPosition(), item->getId(), item->getStackpos(), creature->getId());
}