From c74c0e225067f858b7e34567526faf0c3c492b20 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 26 May 2025 23:52:43 -0700 Subject: [PATCH] fix conditions --- src/ChatCommands.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 13d997ec..2c6bb462 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -464,8 +464,8 @@ static asio::awaitable server_command_bbchar_savechar(const Args& a, bool } // username/password are tokens[0] and [1] - dest_character_index = stoll(tokens[2]) - 1; - if ((dest_character_index >= 127) || (dest_character_index < 0)) { + dest_character_index = stoull(tokens[2]) - 1; + if (dest_character_index >= 127) { throw precondition_failed("$C6Player index must\nbe in range 1-127"); } @@ -478,8 +478,8 @@ static asio::awaitable server_command_bbchar_savechar(const Args& a, bool } } else { - dest_character_index = stoll(a.text) - 1; - if ((dest_character_index >= s->num_backup_character_slots) || (dest_character_index < 0)) { + dest_character_index = stoull(a.text) - 1; + if (dest_character_index >= s->num_backup_character_slots) { throw precondition_failed("$C6Player index must\nbe in range 1-{}", s->num_backup_character_slots); } dest_account = a.c->login->account;