From ea9b37318010e2a77555d51d7b8b34e8355c5aa5 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Mon, 3 Apr 2023 16:25:00 -0400 Subject: [PATCH] [Cleanup] Further bot.cpp nullptr checks (#3240) # Notes - `nullptr` validation --- zone/bot.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index f5d8861bf..e864642be 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3145,8 +3145,7 @@ void Bot::SetOwnerTarget(Client* bot_owner) { AddToHateList(attack_target, 1); SetTarget(attack_target); SetAttackingFlag(); - if (HasPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 2)) { - + if (GetPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 2)) { GetPet()->WipeHateList(); GetPet()->AddToHateList(attack_target, 1); GetPet()->SetTarget(attack_target); @@ -4403,6 +4402,10 @@ void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* for (auto& trade_iterator : client_trade) { // TODO: code for stackables + if (!trade_iterator.trade_item_instance) { + continue; + } + if (!database.botdb.SaveItemBySlot(this, trade_iterator.to_bot_slot, trade_iterator.trade_item_instance)) { OwnerMessage( fmt::format(