1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

Prevented NRE on property field.

This commit is contained in:
lucasmontec 2019-09-24 19:24:21 -03:00
parent 417e63ee6c
commit 38f59506af

View File

@ -25,7 +25,7 @@ namespace XNodeEditor {
public static void PropertyField(SerializedProperty property, GUIContent label, bool includeChildren = true, params GUILayoutOption[] options) { public static void PropertyField(SerializedProperty property, GUIContent label, bool includeChildren = true, params GUILayoutOption[] options) {
if (property == null) throw new NullReferenceException(); if (property == null) throw new NullReferenceException();
XNode.Node node = property.serializedObject.targetObject as XNode.Node; XNode.Node node = property.serializedObject.targetObject as XNode.Node;
XNode.NodePort port = node.GetPort(property.name); XNode.NodePort port = node != null ? node.GetPort(property.name) : null;
PropertyField(property, label, port, includeChildren); PropertyField(property, label, port, includeChildren);
} }