From b7dce00942611cb84dd96a0e81fce6ddaea26ef5 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Tue, 19 Aug 2008 13:05:38 +0000 Subject: Fix for bug #2057656: FW: Assert during demo (regression). Future Wars's Amiga demo is trying to load collision data files 'L8_MK.NEO' and 'L23_MK.NEO' that aren't supplied with the demo. Previous code crashed when a file couldn't be found, now it gives a warning instead. svn-id: r34036 --- engines/cine/bg.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'engines/cine/bg.cpp') diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp index 45bfae7925..cc7e843c2b 100644 --- a/engines/cine/bg.cpp +++ b/engines/cine/bg.cpp @@ -41,10 +41,18 @@ byte loadCtFW(const char *ctName) { uint16 header[32]; byte *ptr, *dataPtr; + int16 foundFileIdx = findFileInBundle(ctName); + if (foundFileIdx == -1) { + warning("loadCtFW: Unable to find collision data file '%s'", ctName); + // FIXME: Rework this function's return value policy and return an appropriate value here. + // The return value isn't yet used for anything so currently it doesn't really matter. + return 0; + } + if (currentCtName != ctName) strcpy(currentCtName, ctName); - ptr = dataPtr = readBundleFile(findFileInBundle(ctName)); + ptr = dataPtr = readBundleFile(foundFileIdx); loadRelatedPalette(ctName); -- cgit v1.2.3