Fix ManagedDictionary error on null object
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -205,6 +205,8 @@ namespace FlaxEngine
|
||||
|
||||
internal static object[] GetDictionaryKeys(IDictionary dictionary)
|
||||
{
|
||||
if (dictionary == null)
|
||||
return null;
|
||||
var keys = dictionary.Keys;
|
||||
var result = new object[keys.Count];
|
||||
keys.CopyTo(result, 0);
|
||||
|
||||
Reference in New Issue
Block a user