From e33b50d9c501bbea6accb10b5fa78105b8ea0e43 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 20 Aug 2019 20:26:07 +0200 Subject: [PATCH] command/all: simplify `return` from command_process() --- src/command/AllCommands.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx index 38e75697f..90d616098 100644 --- a/src/command/AllCommands.cxx +++ b/src/command/AllCommands.cxx @@ -409,12 +409,10 @@ try { const struct command *cmd = command_checked_lookup(r, client.GetPermission(), cmd_name, args); + if (cmd == nullptr) + return CommandResult::ERROR; - CommandResult ret = cmd - ? cmd->handler(client, args, r) - : CommandResult::ERROR; - - return ret; + return cmd->handler(client, args, r); } catch (...) { Response r(client, num); PrintError(r, std::current_exception());