mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Added null check
This commit is contained in:
parent
a1dd3bb9df
commit
42d13ad6a9
@ -243,7 +243,10 @@ namespace XNodeEditor {
|
|||||||
Type type = hoveredPort.ValueType;
|
Type type = hoveredPort.ValueType;
|
||||||
GUIContent content = new GUIContent();
|
GUIContent content = new GUIContent();
|
||||||
content.text = TypeToString(type);
|
content.text = TypeToString(type);
|
||||||
if (hoveredPort.IsStatic && hoveredPort.IsOutput) content.text += " = " + ObjectFromFieldName(hoveredPort.node, hoveredPort.fieldName).ToString();
|
if (hoveredPort.IsStatic && hoveredPort.IsOutput) {
|
||||||
|
object obj = ObjectFromFieldName(hoveredPort.node, hoveredPort.fieldName);
|
||||||
|
if (obj != null) content.text += " = " + obj.ToString();
|
||||||
|
}
|
||||||
Vector2 size = NodeEditorResources.styles.tooltip.CalcSize(content);
|
Vector2 size = NodeEditorResources.styles.tooltip.CalcSize(content);
|
||||||
Rect rect = new Rect(Event.current.mousePosition - (size), size);
|
Rect rect = new Rect(Event.current.mousePosition - (size), size);
|
||||||
EditorGUI.LabelField(rect, content, NodeEditorResources.styles.tooltip);
|
EditorGUI.LabelField(rect, content, NodeEditorResources.styles.tooltip);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user