Change GetProperty return to be nullable

This commit is contained in:
Jarrod Doyle 2024-10-27 08:38:47 +00:00
parent 7ff91b2fda
commit 466b7a4c0b
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@ namespace KeepersCompound.LGS.Database;
public class ObjectHierarchy public class ObjectHierarchy
{ {
public class DarkObject private class DarkObject
{ {
public int objectId; public int objectId;
public int parentId; public int parentId;
@ -17,7 +17,7 @@ public class ObjectHierarchy
properties = new Dictionary<string, Property>(); properties = new Dictionary<string, Property>();
} }
public T GetProperty<T>(string propName) where T : Property public T? GetProperty<T>(string propName) where T : Property
{ {
if (properties.TryGetValue(propName, out var prop)) if (properties.TryGetValue(propName, out var prop))
{ {
@ -102,7 +102,7 @@ public class ObjectHierarchy
} }
// TODO: Work out if there's some nice way to automatically decide if we inherit // TODO: Work out if there's some nice way to automatically decide if we inherit
public T GetProperty<T>(int objectId, string propName, bool inherit = true) where T : Property public T? GetProperty<T>(int objectId, string propName, bool inherit = true) where T : Property
{ {
if (!_objects.ContainsKey(objectId)) if (!_objects.ContainsKey(objectId))
{ {