From 9da329bb7de0a4d4a77b9e91431dbe9bcb5e744a Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 9 Nov 2016 14:30:48 +0000 Subject: [PATCH] Only update Items if successful --- Facepunch.Steamworks/Interfaces/Inventory.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Facepunch.Steamworks/Interfaces/Inventory.cs b/Facepunch.Steamworks/Interfaces/Inventory.cs index d3f85c4..8faa100 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.cs @@ -56,20 +56,21 @@ namespace Facepunch.Steamworks if ( error ) return; var r = new Result( this, data.Handle ); + if ( r.IsSuccess ) + { + SerializedItems = r.Serialize(); + SerializedExpireTime = DateTime.Now.Add( TimeSpan.FromMinutes( 60 ) ); - SerializedItems = r.Serialize(); - SerializedExpireTime = DateTime.Now.Add( TimeSpan.FromMinutes( 60 ) ); + Items = r.Items; - Items = r.Items; + // + // Tell everyone we've got new items! + // + OnUpdate?.Invoke(); + } r.Dispose(); r = null; - - // - // Tell everyone we've got new items! - // - OnUpdate?.Invoke(); - } public void Dispose()