Update CaveGameWindow.cpp

Fix out of bounds read causing sigseg when nothing is entered.
This commit is contained in:
2025-02-12 11:56:52 -05:00
parent 0121af5178
commit f20dec85ce

View File

@@ -554,14 +554,16 @@ namespace CaveGame::ClientApp
return copy;
}
void CaveGameWindow::OnConsoleCommandInput(const std::string& command)
{
void CaveGameWindow::OnConsoleCommandInput(const std::string& command) {
auto tokens = string_split(command, ' ');
if (str_tolower(tokens[0]) == "worldedit") {
tile_tool->Enable(!tile_tool->IsEnabled());
if (tokens.empty())
return;
// Commands that are single length argument.
if (tokens.size() == 1) {
if (str_tolower(tokens[0]) == "worldedit")
tile_tool->Enable(!tile_tool->IsEnabled());
}
}
void CaveGameWindow::create_console_window() {