1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 09:09:09 +00:00

Fix #14081: Check if removed item is a savegame (#14371)

This commit is contained in:
Adam Zmuda
2025-06-18 10:05:18 +02:00
committed by GitHub
parent 7aa4e7fc58
commit 9238f508eb

@@ -543,9 +543,13 @@ static bool ConRemove(std::span<std::string_view> argv)
_console_file_list_savegame.ValidateFileList();
const FiosItem *item = _console_file_list_savegame.FindItem(file);
if (item != nullptr) {
if (item->type.abstract == FT_SAVEGAME) {
if (!FioRemove(item->name)) {
IConsolePrint(CC_ERROR, "Failed to delete '{}'.", item->name);
}
} else {
IConsolePrint(CC_ERROR, "'{}' is not a savegame.", file);
}
} else {
IConsolePrint(CC_ERROR, "'{}' could not be found.", file);
}