Fix crash on exit when loading storage file fails

This commit is contained in:
Wojtek Figat
2021-03-08 11:33:41 +01:00
parent 5f7830d09e
commit fc13351a2b

View File

@@ -78,6 +78,10 @@ FlaxStorageReference ContentStorageManager::GetStorage(const StringView& path, b
LOG(Error, "Failed to load {0}.", path);
Locker.Lock();
StorageMap.Remove(path);
if (result->IsPackage())
Packages.Remove((FlaxPackage*)result);
else
Files.Remove((FlaxFile*)result);
Locker.Unlock();
Delete(result);
return nullptr;