1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Fix #2550 Program crashes when executing "exit" command from the console

- exit and quit commands are aliased to "hide"
 - value of the command was being set to a constant value and could not be freed
 - updated command value to use a freeable value
This commit is contained in:
Ian Spence
2015-12-30 08:57:43 -08:00
parent edaec24228
commit ae7da3e830

View File

@@ -1045,8 +1045,10 @@ void console_execute_silent(const utf8 *src)
return;
// Aliases for hiding the console
if(strcmp(argv[0],"quit") == 0 || strcmp(argv[0],"exit") == 0)
argv[0]="hide";
if(strcmp(argv[0],"quit") == 0 || strcmp(argv[0],"exit") == 0) {
free(argv[0]);
argv[0] = _strdup("hide");
}
bool validCommand = false;
for (int i = 0; i < countof(console_command_table); i++) {