Skip to content

Commit 90145ca

Browse files
committed
#15 check if the object's property is not null
1 parent 76ee36f commit 90145ca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Neo4j.Map.Extension/Map/NodeExtension.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ private static string MatchQuery<T>(T node) where T : Neo4jNode
109109
foreach (PropertyInfo propInfo in node.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly))
110110
{
111111
Neo4jPropertyAttribute attr = propInfo.GetCustomAttribute<Neo4jPropertyAttribute>();
112-
if (attr != null)
112+
var value = propInfo.GetValue(node);
113+
if (attr != null && value != null)
113114
{
114115
if (propInfo.PropertyType.IsEnum)
115-
values.Add(attr.Name, TryGetEnumValueDescription(propInfo, propInfo.GetValue(node)));
116+
values.Add(attr.Name, TryGetEnumValueDescription(propInfo, value));
116117
else
117-
values.Add(attr.Name, propInfo.GetValue(node));
118+
values.Add(attr.Name, value);
118119
}
119120
}
120121
foreach (KeyValuePair<string, object> keyValue in values)

0 commit comments

Comments
 (0)