Fix ManagedDictionary error on null object

This commit is contained in:
Wojtek Figat
2023-03-29 10:32:30 +02:00
parent de566a361a
commit fd23a61846
2 changed files with 5 additions and 1 deletions

View File

@@ -53,7 +53,9 @@ struct FLAXENGINE_API ManagedDictionary
Dictionary<KeyType, ValueType> result;
const ManagedDictionary wrapper(managed);
MArray* managedKeys = wrapper.GetKeys();
int32 length = managedKeys ? MCore::Array::GetLength(managedKeys) : 0;
if (managedKeys == nullptr)
return result;
int32 length = MCore::Array::GetLength(managedKeys);
Array<KeyType> keys;
keys.Resize(length);
result.EnsureCapacity(length);