added ignoring remaining level chunks after chunks with errors
authorHolger Schemel <info@artsoft.org>
Sat, 27 Aug 2022 09:01:50 +0000 (11:01 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 27 Aug 2022 09:23:35 +0000 (11:23 +0200)
src/files.c

index 49fe48569f6ddad83e5d5d78144075a60f07093d..e86364db9f077fd4b678703a0394069b25e58c24 100644 (file)
@@ -3591,6 +3591,14 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level,
        int chunk_size_expected =
          (chunk_info[i].loader)(file, chunk_size, level);
 
+       if (chunk_size_expected < 0)
+       {
+         Warn("error reading chunk '%s' in level file '%s'",
+              chunk_name, filename);
+
+         break;
+       }
+
        // the size of some chunks cannot be checked before reading other
        // chunks first (like "HEAD" and "BODY") that contain some header
        // information, so check them here