diff --git a/addons/GodotDI/Editor/Plugin.cs b/addons/GodotDI/Editor/Plugin.cs index 0414db1..fe5a01f 100644 --- a/addons/GodotDI/Editor/Plugin.cs +++ b/addons/GodotDI/Editor/Plugin.cs @@ -77,6 +77,9 @@ public partial class Plugin : EditorPlugin // mark debounce as completed _sceneTreeTimer = null; + // check that the instance is still valid after debouncing (could have been disposed) + if (!IsInstanceValid(sceneRoot)) return; + var sceneNodes = sceneRoot.FindChildren("*").Where(node => node.Owner == sceneRoot).Append(sceneRoot).ToList(); GD.Print($"Updating injection for root {sceneRoot.Name}");