Load .lvl with corrupted custom blocks section (Thanks icanttellyou/Smappy767)

This commit is contained in:
UnknownShadow200 2021-08-13 22:47:37 +10:00
parent cfb4917c92
commit 02a2410925

View File

@ -204,7 +204,17 @@ cc_result Lvl_Load(struct Stream* stream) {
if (res == ERR_END_OF_STREAM) return 0; if (res == ERR_END_OF_STREAM) return 0;
if (res) return res; if (res) return res;
return section == 0xBD ? Lvl_ReadCustomBlocks(&compStream) : 0; /* Unrecognised section type, stop reading */
if (section != 0xBD) return 0;
res = Lvl_ReadCustomBlocks(&compStream);
/* At least one map out there has a corrupted 0xBD section */
if (res == ERR_END_OF_STREAM) {
Chat_AddRaw("&cEnd of stream reading .lvl custom blocks section");
Chat_AddRaw("&c Some blocks may therefore appear incorrectly");
res = 0;
}
return res;
} }