Fixed crash on loading malformed DeHackEd patches

Lump that contains only "Patch File for DeHackEd v3.0" (without line break at the end) caused a crash
This commit is contained in:
alexey.lysiuk 2018-03-21 13:03:44 +02:00
parent 88bebaec39
commit 92f10febe8

View file

@ -564,6 +564,8 @@ static void stripwhite (char *str)
static char *igets (void)
{
assert(PatchPt != nullptr);
char *line;
if (*PatchPt == '\0' || PatchPt >= PatchFile + PatchSize )
@ -2550,7 +2552,7 @@ static bool DoDehPatch()
}
PatchPt = strchr (PatchFile, '\n');
while ((cont = GetLine()) == 1)
while (PatchPt != nullptr && (cont = GetLine()) == 1)
{
CHECKKEY ("Doom version", dversion)
else CHECKKEY ("Patch format", pversion)