mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Better error handling for InstancePortLists
This commit is contained in:
parent
8f33f5ddf3
commit
96d73bcb81
@ -304,6 +304,10 @@ namespace XNodeEditor {
|
||||
(Rect rect, int index, bool isActive, bool isFocused) => {
|
||||
XNode.NodePort port = node.GetPort(arrayData.name + " " + index);
|
||||
if (hasArrayData) {
|
||||
if (arrayData.arraySize <= index) {
|
||||
EditorGUI.LabelField(rect, "Invalid element " + index);
|
||||
return;
|
||||
}
|
||||
SerializedProperty itemData = arrayData.GetArrayElementAtIndex(index);
|
||||
EditorGUI.PropertyField(rect, itemData);
|
||||
} else EditorGUI.LabelField(rect, port.fieldName);
|
||||
@ -313,6 +317,7 @@ namespace XNodeEditor {
|
||||
list.elementHeightCallback =
|
||||
(int index) => {
|
||||
if (hasArrayData) {
|
||||
if (arrayData.arraySize <= index) return EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty itemData = arrayData.GetArrayElementAtIndex(index);
|
||||
return EditorGUI.GetPropertyHeight(itemData);
|
||||
} else return EditorGUIUtility.singleLineHeight;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user