1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 17:26:02 +08:00

Added null check

This commit is contained in:
Thor Brigsted 2017-11-06 01:32:29 +01:00
parent a1dd3bb9df
commit 42d13ad6a9

View File

@ -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);