From 1d952f8d69830b2b3dfcc87f8df715cabf573fae Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Mon, 18 Nov 2019 12:23:54 +0100 Subject: [PATCH] C#: Throw NullReferenceException for null NodePath/RID params (cherry picked from commit 008769aee9ccacdf5098a1088fcd6cfd52c0644d) --- modules/mono/glue/Managed/Files/NodePath.cs | 2 +- modules/mono/glue/Managed/Files/RID.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mono/glue/Managed/Files/NodePath.cs b/modules/mono/glue/Managed/Files/NodePath.cs index 94a4ed1de96..77f3947d57e 100644 --- a/modules/mono/glue/Managed/Files/NodePath.cs +++ b/modules/mono/glue/Managed/Files/NodePath.cs @@ -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); diff --git a/modules/mono/glue/Managed/Files/RID.cs b/modules/mono/glue/Managed/Files/RID.cs index f1268c85180..5c5320e2c27 100644 --- a/modules/mono/glue/Managed/Files/RID.cs +++ b/modules/mono/glue/Managed/Files/RID.cs @@ -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);