diff --git a/src/strategy/Value.cpp b/src/strategy/Value.cpp index 4f64319e..464e0d1f 100644 --- a/src/strategy/Value.cpp +++ b/src/strategy/Value.cpp @@ -136,4 +136,12 @@ Unit* UnitCalculatedValue::Get() if (value && value->IsInWorld()) return value; return nullptr; +} + +Unit* UnitManualSetValue::Get() +{ + // Prevent crashing by InWorld check + if (value && value->IsInWorld()) + return value; + return nullptr; } \ No newline at end of file diff --git a/src/strategy/Value.h b/src/strategy/Value.h index 9ab4b89a..9cba6efe 100644 --- a/src/strategy/Value.h +++ b/src/strategy/Value.h @@ -323,6 +323,7 @@ class UnitManualSetValue : public ManualSetValue ManualSetValue(botAI, defaultValue, name) { } std::string const Format() override; + Unit* Get() override; }; #endif