diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 84b6aa48f..adf0b2cd0 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1626,7 +1626,13 @@ void FMapInfoParser::ParseEpisodeInfo () } else { - FEpisode *epi = &AllEpisodes[AllEpisodes.Reserve(1)]; + // Only allocate a new entry if this doesn't replace an existing episode. + if (i >= AllEpisodes.Size()) + { + i = AllEpisodes.Reserve(1); + } + + FEpisode *epi = &AllEpisodes[i]; epi->mEpisodeMap = map; epi->mEpisodeName = name; diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index a751caf5c..79ae99a23 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -1327,7 +1327,7 @@ void M_StartupSkillMenu(FGameStartup *gs) } if (AllEpisodes[gs->Episode].mNoSkill || AllSkills.Size() == 1) { - ld->mAutoselect = firstitem + MIN(2u, AllEpisodes.Size()-1); + ld->mAutoselect = firstitem + MIN(2u, AllSkills.Size()-1); } else {