mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-23 10:42:25 +00:00
[Cleanup] Validate for nullptrs in bot.cpp (#3232)
* [Cleanup] Validate for nullptrs in bot.cpp # Notes - Validate for nullptrs in these spots in bot.cpp before using the variable. * Update bot.cpp
This commit is contained in:
parent
a40e1cf893
commit
d1b7c675f9
15
zone/bot.cpp
15
zone/bot.cpp
@ -2413,6 +2413,10 @@ bool Bot::TrySecondaryWeaponAttacks(Mob* tar, const EQ::ItemInstance* s_item) {
|
|||||||
s_itemdata = s_item->GetItem();
|
s_itemdata = s_item->GetItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!s_itemdata) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool use_fist = true;
|
bool use_fist = true;
|
||||||
if (s_itemdata) {
|
if (s_itemdata) {
|
||||||
use_fist = false;
|
use_fist = false;
|
||||||
@ -3666,6 +3670,10 @@ void Bot::BotRemoveEquipItem(uint16 slot_id)
|
|||||||
|
|
||||||
void Bot::BotTradeAddItem(const EQ::ItemInstance* inst, uint16 slot_id, std::string* error_message, bool save_to_database)
|
void Bot::BotTradeAddItem(const EQ::ItemInstance* inst, uint16 slot_id, std::string* error_message, bool save_to_database)
|
||||||
{
|
{
|
||||||
|
if (!inst) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (save_to_database) {
|
if (save_to_database) {
|
||||||
if (!database.botdb.SaveItemBySlot(this, slot_id, inst)) {
|
if (!database.botdb.SaveItemBySlot(this, slot_id, inst)) {
|
||||||
*error_message = BotDatabase::fail::SaveItemBySlot();
|
*error_message = BotDatabase::fail::SaveItemBySlot();
|
||||||
@ -4626,8 +4634,13 @@ return true;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bot::Damage(Mob *from, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, eSpecialAttacks special) {
|
void Bot::Damage(Mob *from, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, eSpecialAttacks special) {
|
||||||
if (spell_id == 0)
|
if (!from) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spell_id == 0) {
|
||||||
spell_id = SPELL_UNKNOWN;
|
spell_id = SPELL_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
//handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds
|
//handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds
|
||||||
if (attacked_timer.Check()) {
|
if (attacked_timer.Check()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user