mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Crash fix] Unit in world check for manual set value
This commit is contained in:
@@ -137,3 +137,11 @@ Unit* UnitCalculatedValue::Get()
|
|||||||
return value;
|
return value;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unit* UnitManualSetValue::Get()
|
||||||
|
{
|
||||||
|
// Prevent crashing by InWorld check
|
||||||
|
if (value && value->IsInWorld())
|
||||||
|
return value;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
@@ -323,6 +323,7 @@ class UnitManualSetValue : public ManualSetValue<Unit*>
|
|||||||
ManualSetValue<Unit*>(botAI, defaultValue, name) { }
|
ManualSetValue<Unit*>(botAI, defaultValue, name) { }
|
||||||
|
|
||||||
std::string const Format() override;
|
std::string const Format() override;
|
||||||
|
Unit* Get() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user