mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 17:59:24 +01:00
fixed GenericDataHolder nre
This commit is contained in:
parent
18c79bbf3a
commit
52328cc18d
1 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MLEM.Misc {
|
||||
|
@ -6,11 +7,12 @@ namespace MLEM.Misc {
|
|||
private Dictionary<string, object> data;
|
||||
|
||||
public void SetData(string key, object data) {
|
||||
if (this.data == null)
|
||||
this.data = new Dictionary<string, object>();
|
||||
if (data == default) {
|
||||
this.data.Remove(key);
|
||||
if (this.data != null)
|
||||
this.data.Remove(key);
|
||||
} else {
|
||||
if (this.data == null)
|
||||
this.data = new Dictionary<string, object>();
|
||||
this.data[key] = data;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +24,8 @@ namespace MLEM.Misc {
|
|||
}
|
||||
|
||||
public IReadOnlyCollection<string> GetDataKeys() {
|
||||
if (this.data == null)
|
||||
return Array.Empty<string>();
|
||||
return this.data.Keys;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue