From d91ba6d84ab8df3e16ddf794926bc8f3d5165cdb Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Thu, 11 Apr 2019 21:38:06 +0100 Subject: [PATCH] Throw error if interface_pointer is null --- Generator/CodeWriter/Class.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Generator/CodeWriter/Class.cs b/Generator/CodeWriter/Class.cs index 1077a63..1c0790f 100644 --- a/Generator/CodeWriter/Class.cs +++ b/Generator/CodeWriter/Class.cs @@ -430,7 +430,8 @@ private void Detect_InterfaceReturn( List argList, List call ReturnVar = "interface_pointer"; ReturnType = ReturnType.Substring( 1 ).Trim( '*', ' ' ); - AfterLines.Add( $"return new {ReturnType}( steamworks, interface_pointer );" ); + AfterLines.Add( $"if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $\"Error getting interface {{pchVersion}}\");" ); + AfterLines.Add( $"return new {ReturnType}( steamworks, interface_pointer );" ); } private void Detect_VectorReturn( List argList, List callArgs )