diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-02-19 00:37:10 +0100 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-02-19 00:37:15 +0100 |
commit | efd5d4bcf9fc15a92ef40e3f6edb185d190cd50e (patch) | |
tree | 88110a7b400d9962ccbd611fd6bab0565ae27955 /modules/mono/glue/Managed/Files/NodePath.cs | |
parent | 325efb60b7b4f7cb4ed11097c8f2e2de973e00d0 (diff) | |
download | redot-engine-efd5d4bcf9fc15a92ef40e3f6edb185d190cd50e.tar.gz |
C#: Throw ObjectDisposedException from disposed wrapper classes
Diffstat (limited to 'modules/mono/glue/Managed/Files/NodePath.cs')
-rw-r--r-- | modules/mono/glue/Managed/Files/NodePath.cs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/mono/glue/Managed/Files/NodePath.cs b/modules/mono/glue/Managed/Files/NodePath.cs index 2c89bec87f..7cecbeeda5 100644 --- a/modules/mono/glue/Managed/Files/NodePath.cs +++ b/modules/mono/glue/Managed/Files/NodePath.cs @@ -11,7 +11,13 @@ namespace Godot internal static IntPtr GetPtr(NodePath instance) { - return instance == null ? IntPtr.Zero : instance.ptr; + if (instance == null) + return IntPtr.Zero; + + if (instance.disposed) + throw new ObjectDisposedException(instance.GetType().FullName); + + return instance.ptr; } ~NodePath() @@ -49,7 +55,7 @@ namespace Godot get { return ptr; } } - public NodePath() : this(string.Empty) {} + public NodePath() : this(string.Empty) { } public NodePath(string path) { |