From aeaaf180997cc5d4f506df9a2d70921ed4c9644d Mon Sep 17 00:00:00 2001 From: DeepWolf413 Date: Wed, 23 Oct 2019 12:01:20 +0200 Subject: [PATCH] Added a null check for NodeEditorWindow.current. It returns a new instance of the Settings class if the NodeEditorWindow.current is null. --- Scripts/Editor/NodeEditorPreferences.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Scripts/Editor/NodeEditorPreferences.cs b/Scripts/Editor/NodeEditorPreferences.cs index 642e672..467318a 100644 --- a/Scripts/Editor/NodeEditorPreferences.cs +++ b/Scripts/Editor/NodeEditorPreferences.cs @@ -81,6 +81,8 @@ namespace XNodeEditor { /// Get settings of current active editor public static Settings GetSettings() { + if (XNodeEditor.NodeEditorWindow.current == null) return new Settings(); + if (lastEditor != XNodeEditor.NodeEditorWindow.current.graphEditor) { object[] attribs = XNodeEditor.NodeEditorWindow.current.graphEditor.GetType().GetCustomAttributes(typeof(XNodeEditor.NodeGraphEditor.CustomNodeGraphEditorAttribute), true); if (attribs.Length == 1) {