From b4c48242cb2e1d02d1ce144cb54c08056d3ac60c Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Fri, 21 Oct 2016 11:00:24 +0100 Subject: [PATCH] Null ref checks on dispose --- Facepunch.Steamworks/BaseSteamworks.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Facepunch.Steamworks/BaseSteamworks.cs b/Facepunch.Steamworks/BaseSteamworks.cs index ee06870..daff08e 100644 --- a/Facepunch.Steamworks/BaseSteamworks.cs +++ b/Facepunch.Steamworks/BaseSteamworks.cs @@ -25,14 +25,23 @@ public virtual void Dispose() } Disposables.Clear(); - Workshop.Dispose(); - Workshop = null; + if ( Workshop != null ) + { + Workshop.Dispose(); + Workshop = null; + } - Inventory.Dispose(); - Inventory = null; + if ( Inventory != null ) + { + Inventory.Dispose(); + Inventory = null; + } - Networking.Dispose(); - Networking = null; + if ( Networking != null ) + { + Networking.Dispose(); + Networking = null; + } if ( native != null ) {