From: Guus Sliepen Date: Sun, 9 Aug 2015 13:18:27 +0000 (+0200) Subject: Prevent a segmentation fault when using the -map option without specifying a map. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c82ce5aefd7d98727d8ddd43c091f7c617b0a7a5;p=quix0rs-blobwars.git Prevent a segmentation fault when using the -map option without specifying a map. --- diff --git a/src/main.cpp b/src/main.cpp index ba11d63..9516517 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) else if (strcmp(argv[i], "--help") == 0) showHelp(); else if (strcmp(argv[i], "-record") == 0) {recordMode = REPLAY_MODE::RECORD; strlcpy(replayData.filename, argv[++i], sizeof replayData.filename);} else if (strcmp(argv[i], "-playback") == 0) {recordMode = REPLAY_MODE::PLAYBACK; strlcpy(replayData.filename, argv[++i], sizeof replayData.filename);} - else if (strcmp(argv[i], "-map") == 0) {game.setMapName(argv[++i]); requiredSection = SECTION_GAME;} + else if (strcmp(argv[i], "-map") == 0) {if (argc > i + 1) {game.setMapName(argv[++i]); requiredSection = SECTION_GAME;}} else if (strcmp(argv[i], "-listmaps") == 0) listMaps(); else if (strcmp(argv[i], "-credits") == 0) requiredSection = SECTION_CREDITS;