Fix #4893: Assertion failed if no RCT2 directory selected on startup

Bit of a hack, temporary until ObjectManager gets same initialisation treatment as ObjectRepository.
This commit is contained in:
Ted John 2016-12-24 01:02:57 +00:00
parent 463ec2025a
commit a79e742f39
1 changed files with 8 additions and 2 deletions

View File

@ -535,7 +535,10 @@ IObjectManager * GetObjectManager()
if (_objectManager == nullptr)
{
IObjectRepository * objectRepository = GetObjectRepository();
_objectManager = std::unique_ptr<ObjectManager>(new ObjectManager(objectRepository));
if (objectRepository != nullptr)
{
_objectManager = std::unique_ptr<ObjectManager>(new ObjectManager(objectRepository));
}
}
return _objectManager.get();
}
@ -580,6 +583,9 @@ extern "C"
void object_manager_unload_all_objects()
{
IObjectManager * objectManager = GetObjectManager();
objectManager->UnloadAll();
if (objectManager != nullptr)
{
objectManager->UnloadAll();
}
}
}