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 @@ public class Result : IDisposable 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 @@ internal unsafe byte[] Serialize() public void Dispose() { - inventory.inventory.DestroyResult( Handle ); - Handle = -1; + if ( Handle != -1 && inventory != null ) + { + inventory.inventory.DestroyResult( Handle ); + Handle = -1; + } + inventory = null; } }