From d6e5175a0bf790c5e87b47883045b5d600e4cb74 Mon Sep 17 00:00:00 2001 From: taoria <445625470@qq.com> Date: Thu, 1 Sep 2022 11:14:17 +0800 Subject: [PATCH] fix:add a guardian when create blackboard data entry --- .../Editor/GraphBlackboard/DefaultGraphBlackboardView.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TNodeGraphViewImpl/Editor/GraphBlackboard/DefaultGraphBlackboardView.cs b/TNodeGraphViewImpl/Editor/GraphBlackboard/DefaultGraphBlackboardView.cs index 024162b..0f05ef3 100644 --- a/TNodeGraphViewImpl/Editor/GraphBlackboard/DefaultGraphBlackboardView.cs +++ b/TNodeGraphViewImpl/Editor/GraphBlackboard/DefaultGraphBlackboardView.cs @@ -88,8 +88,11 @@ namespace TNodeGraphViewImpl.Editor.GraphBlackboard{ bool isRuntimeGraph, BlackboardSection blackboardSection, int index){ var property = serializedObject.FindProperty("data"); - property = property.FindPropertyRelative(field.Name).GetArrayElementAtIndex(index); - + property = property.FindPropertyRelative(field.Name)?.GetArrayElementAtIndex(index); + if (property == null){ + + Debug.LogError($"Can not find property {field.Name} in {serializedObject.targetObject.name}"); + } BlackboardDataEntry entry = new BlackboardDataEntry(field.FieldType){ propertyPath = field.Name+"."+index, };