From ad4fd3bfaccf526a33352dbc10be7d6e427ceb35 Mon Sep 17 00:00:00 2001 From: Netshroud Date: Sat, 29 Dec 2012 23:28:06 +1100 Subject: [PATCH] DepotDownloader: Fixed NullReferenceException, fixed not reloading CDR if cdr.proto is deleted --HG-- extra : amend_source : b4a997ff2524895120eaf1f53aa240685846f85a --- DepotDownloader/CDRManager.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DepotDownloader/CDRManager.cs b/DepotDownloader/CDRManager.cs index 1dee0906..22ffd2de 100644 --- a/DepotDownloader/CDRManager.cs +++ b/DepotDownloader/CDRManager.cs @@ -110,9 +110,11 @@ namespace DepotDownloader { Console.Write( "Updating CDR..." ); - if (DateTime.Now > ConfigCache.Instance.CDRCacheTime) + var hasCachedCDR = File.Exists(CDR_FILENAME); + + if (DateTime.Now > ConfigCache.Instance.CDRCacheTime || !hasCachedCDR) { - byte[] cdrHash = ConfigCache.Instance.CDRHash; + byte[] cdrHash = hasCachedCDR ? ConfigCache.Instance.CDRHash : null; foreach (var configServer in ServerCache.ConfigServers) { @@ -350,7 +352,7 @@ namespace DepotDownloader { App app = GetAppBlob( depotId ); - if ( app.UserDefined == null ) + if (app == null || app.UserDefined == null ) return null; foreach ( var entry in app.UserDefined )