From 17c7c32a5828871dfcc01cd3b3c9be6a72c669d4 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 26 May 2013 02:56:25 +0000 Subject: [PATCH] - Fixed potential uninitialized access in FMapInfoParser::ParseEndGame(). SVN r4287 (trunk) --- src/intermission/intermission_parse.cpp | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/intermission/intermission_parse.cpp b/src/intermission/intermission_parse.cpp index d621d4c6cb..6166e608f0 100644 --- a/src/intermission/intermission_parse.cpp +++ b/src/intermission/intermission_parse.cpp @@ -660,7 +660,7 @@ FName FMapInfoParser::ParseEndGame() } } FIntermissionDescriptor *desc = new FIntermissionDescriptor; - FIntermissionAction *action; + FIntermissionAction *action = NULL; switch (newSeq.EndType) { @@ -699,15 +699,23 @@ FName FMapInfoParser::ParseEndGame() break; } - action->mBackground = newSeq.PicName; - action->mMusic = newSeq.Music; - action->mMusicLooping = newSeq.MusicLooping; - desc->mActions.Push(action); + if (action == NULL) + { + sc.ScriptError("Endgame type was not defined"); + return NAME_None; // We won't really get here. + } + else + { + action->mBackground = newSeq.PicName; + action->mMusic = newSeq.Music; + action->mMusicLooping = newSeq.MusicLooping; + desc->mActions.Push(action); - FString seq; - seq.Format("@EndSequence_%d_", generated++); - ReplaceIntermission(seq, desc); - return FName(seq); + FString seq; + seq.Format("@EndSequence_%d_", generated++); + ReplaceIntermission(seq, desc); + return FName(seq); + } } //==========================================================================