Skip to content

Commit

Permalink
-Crash fix: Bots getting mail with items where the item was already g…
Browse files Browse the repository at this point in the history
…one.
  • Loading branch information
mostlikely4r committed Sep 15, 2024
1 parent f7b12b3 commit e3c9941
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions playerbot/strategy/actions/MailAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,18 @@ class TakeMailProcessor : public MailProcessor
#endif
Item* item = bot->GetMItem(*i);

if (event.getSource() == "rpg action")
if (item)
{
items.push_back(ChatHelper::formatItem(item, item->GetCount()));
}
else
{
std::ostringstream out;
out << mail->subject << ", " << ChatHelper::formatItem(item) << "|cff00ff00 processed";
ai->TellPlayer(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false);
if (event.getSource() == "rpg action")
{
items.push_back(ChatHelper::formatItem(item, item->GetCount()));
}
else
{
std::ostringstream out;
out << mail->subject << ", " << ChatHelper::formatItem(item) << "|cff00ff00 processed";
ai->TellPlayer(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false);
}
}

bot->GetSession()->HandleMailTakeItem(packet);
Expand Down

0 comments on commit e3c9941

Please sign in to comment.