Fix: 968 bug using lookup command with no parameters crashes instance (#970)

* Update SlashCommandHandler.cpp

* Update SlashCommandHandler.cpp
This commit is contained in:
Gie "Max" Vanommeslaeghe 2023-01-25 00:09:32 +01:00 committed by GitHub
parent ac5f08f601
commit cdffd5ff30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1199,7 +1199,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
EntityManager::Instance()->SerializeEntity(entity);
}
if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() >= 1) {
auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT `id`, `name` FROM `Objects` WHERE `displayName` LIKE ?1 OR `name` LIKE ?1 OR `description` LIKE ?1 LIMIT 50");
// Concatenate all of the arguments into a single query so a multi word query can be used properly.