From c4617c58841c02f97bd6c8631e6555367510001f Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Thu, 15 Feb 2018 14:03:28 +0000 Subject: [PATCH] Fixed NRE in inventory result dispose --- Facepunch.Steamworks/Interfaces/Inventory.Result.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Facepunch.Steamworks/Interfaces/Inventory.Result.cs b/Facepunch.Steamworks/Interfaces/Inventory.Result.cs index b09befd..3f1bfa2 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.Result.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.Result.cs @@ -14,7 +14,7 @@ namespace Facepunch.Steamworks internal static Dictionary< int, Result > Pending; internal Inventory inventory; - private SteamNative.SteamInventoryResult_t Handle { get; set; } + private SteamNative.SteamInventoryResult_t Handle { get; set; } = -1; /// /// Called when result is successfully returned @@ -169,8 +169,12 @@ namespace Facepunch.Steamworks public void Dispose() { - inventory.inventory.DestroyResult( Handle ); - Handle = -1; + if ( Handle != -1 && inventory != null ) + { + inventory.inventory.DestroyResult( Handle ); + Handle = -1; + } + inventory = null; } }