C#: Throw NullReferenceException for null NodePath/RID params

(cherry picked from commit 008769aee9)
This commit is contained in:
Ignacio Etcheverry 2019-11-18 12:23:54 +01:00 committed by Rémi Verschelde
parent bf204bdc7c
commit 1d952f8d69
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ namespace Godot
internal static IntPtr GetPtr(NodePath instance)
{
if (instance == null)
return IntPtr.Zero;
throw new NullReferenceException($"The instance of type {nameof(NodePath)} is null.");
if (instance.disposed)
throw new ObjectDisposedException(instance.GetType().FullName);

View File

@ -12,7 +12,7 @@ namespace Godot
internal static IntPtr GetPtr(RID instance)
{
if (instance == null)
return IntPtr.Zero;
throw new NullReferenceException($"The instance of type {nameof(RID)} is null.");
if (instance.disposed)
throw new ObjectDisposedException(instance.GetType().FullName);