mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 00:58:33 +00:00
Fix GetGuidValue crash
This commit is contained in:
@@ -113,3 +113,27 @@ std::string const ObjectGuidListCalculatedValue::Format()
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
Unit* UnitCalculatedValue::Get()
|
||||
{
|
||||
if (checkInterval < 2) {
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
} else {
|
||||
time_t now = getMSTime();
|
||||
if (!lastCheckTime || now - lastCheckTime >= checkInterval)
|
||||
{
|
||||
lastCheckTime = now;
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
}
|
||||
}
|
||||
// Prevent crashing by InWorld check
|
||||
if (value && value->IsInWorld())
|
||||
return value;
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user