|
@@ -9,11 +9,11 @@ namespace InABox.Core
|
|
|
{
|
|
|
public interface ISubObject
|
|
|
{
|
|
|
- BaseObject GetLinkedParent();
|
|
|
+ BaseObject? GetLinkedParent();
|
|
|
|
|
|
void SetLinkedParent(BaseObject obj);
|
|
|
|
|
|
- string GetLinkedPath();
|
|
|
+ string? GetLinkedPath();
|
|
|
|
|
|
void SetLinkedPath(string path);
|
|
|
}
|
|
@@ -27,7 +27,7 @@ namespace InABox.Core
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- _rootDictionary ??= LinkedProperties.GetParent(Object).OriginalValueList;
|
|
|
+ _rootDictionary ??= (LinkedProperties.GetParent(Object)?.OriginalValueList ?? new OriginalValues());
|
|
|
return _rootDictionary;
|
|
|
}
|
|
|
}
|
|
@@ -106,7 +106,7 @@ namespace InABox.Core
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- _rootSet ??= LinkedProperties.GetParent(Object).LoadedColumns;
|
|
|
+ _rootSet ??= (LinkedProperties.GetParent(Object)?.LoadedColumns ?? new LoadedColumns());
|
|
|
return _rootSet;
|
|
|
}
|
|
|
}
|
|
@@ -178,7 +178,7 @@ namespace InABox.Core
|
|
|
return filtered;
|
|
|
}*/
|
|
|
|
|
|
- public static BaseObject GetParent(ISubObject link)
|
|
|
+ public static BaseObject? GetParent(ISubObject link)
|
|
|
{
|
|
|
while (true)
|
|
|
{
|
|
@@ -187,14 +187,14 @@ namespace InABox.Core
|
|
|
{
|
|
|
link = parentLink;
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
return parent;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static string GetPath(ISubObject link)
|
|
|
+ public static string? GetPath(ISubObject link)
|
|
|
{
|
|
|
var path = link.GetLinkedPath();
|
|
|
while (true)
|
|
@@ -224,7 +224,7 @@ namespace InABox.Core
|
|
|
public static IEnumerable<ILinkedProperty> Find(ISubObject subObject, out BaseObject parent)
|
|
|
{
|
|
|
parent = GetParent(subObject);
|
|
|
- if (!_LinkedProperties.TryGetValue(parent.GetType(), out var props))
|
|
|
+ if (parent is null || !_LinkedProperties.TryGetValue(parent.GetType(), out var props))
|
|
|
{
|
|
|
return Enumerable.Empty<ILinkedProperty>();
|
|
|
}
|
|
@@ -233,12 +233,13 @@ namespace InABox.Core
|
|
|
return props.Where(x => x.Path == path);
|
|
|
}
|
|
|
|
|
|
- public static bool Find(ISubObject subObject, string name, [NotNullWhen(true)] out ILinkedProperty? property, out BaseObject parent)
|
|
|
+ public static bool Find(ISubObject subObject, string name, [NotNullWhen(true)] out ILinkedProperty? property, [NotNullWhen(true)] out BaseObject? parent)
|
|
|
{
|
|
|
property = null;
|
|
|
parent = GetParent(subObject);
|
|
|
- if (parent == null)
|
|
|
+ if (parent is null)
|
|
|
return false;
|
|
|
+
|
|
|
if(!_LinkedProperties.TryGetValue(parent.GetType(), out var props))
|
|
|
return false;
|
|
|
var path = GetPath(subObject);
|