From 587a5d5d9a05a24300f0d593f760315b2e615cff Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 15 Apr 2020 21:35:16 +1000 Subject: [PATCH] - fix loading of CRC cache if file does not exist. --- source/common/engine/sc_man.cpp | 2 +- source/core/searchpaths.cpp | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/source/common/engine/sc_man.cpp b/source/common/engine/sc_man.cpp index af5d5d1c2..96c79538c 100644 --- a/source/common/engine/sc_man.cpp +++ b/source/common/engine/sc_man.cpp @@ -1119,7 +1119,7 @@ void FScanner::CheckOpen() { if (ScriptOpen == false) { - I_FatalError ("SC_ call before SC_Open()."); + I_Error ("SC_ call before SC_Open()."); } } diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index 9de094f72..d95dba02e 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -328,18 +328,20 @@ static TArray LoadCRCCache(void) try { - sc.OpenFile(cachepath); - while (sc.GetString()) + if (sc.OpenFile(cachepath)) { - crclist.Reserve(1); - auto &flentry = crclist.Last(); - flentry.FileName = sc.String; - sc.MustGetNumber(); - flentry.FileLength = sc.BigNumber; - sc.MustGetNumber(); - flentry.FileTime = sc.BigNumber; - sc.MustGetNumber(); - flentry.CRCValue = (unsigned)sc.BigNumber; + while (sc.GetString()) + { + crclist.Reserve(1); + auto &flentry = crclist.Last(); + flentry.FileName = sc.String; + sc.MustGetNumber(); + flentry.FileLength = sc.BigNumber; + sc.MustGetNumber(); + flentry.FileTime = sc.BigNumber; + sc.MustGetNumber(); + flentry.CRCValue = (unsigned)sc.BigNumber; + } } } catch (CRecoverableError &)