1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Fix #15298: Crash on map.getAllEntities from in-game console (#15301)

This commit is contained in:
Hielke Morsink
2021-08-28 17:43:11 +02:00
committed by GitHub
parent 97ded2d7c4
commit e0751d707f

View File

@@ -1433,7 +1433,16 @@ int32_t OpenRCT2::Scripting::GetTargetAPIVersion()
{
auto& scriptEngine = GetContext()->GetScriptEngine();
auto& execInfo = scriptEngine.GetExecInfo();
return execInfo.GetCurrentPlugin()->GetTargetAPIVersion();
// Commands from the in-game console do not have a plug-in set
auto plugin = execInfo.GetCurrentPlugin();
if (plugin == nullptr)
{
// For in-game console, default to the current API version
return OPENRCT2_PLUGIN_API_VERSION;
}
return plugin->GetTargetAPIVersion();
}
#endif