From 70c64ab943f12e1dfb3f89064b5fc6ab4b146ef3 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Tue, 22 Oct 2024 19:52:17 +0200 Subject: [PATCH] Update parsing arguments --- cpp/s2pexec/s2pexec_core.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cpp/s2pexec/s2pexec_core.cpp b/cpp/s2pexec/s2pexec_core.cpp index 47819649..1b94e8ec 100644 --- a/cpp/s2pexec/s2pexec_core.cpp +++ b/cpp/s2pexec/s2pexec_core.cpp @@ -230,10 +230,8 @@ bool S2pExec::ParseArguments(span args) } if (!command.empty()) { - if (!initiator.empty()) { - if (!GetAsUnsignedInt(initiator, initiator_id) || initiator_id > 7) { - throw parser_exception("Invalid initiator ID: '" + initiator + "' (0-7)"); - } + if (!initiator.empty() && (!GetAsUnsignedInt(initiator, initiator_id) || initiator_id > 7)) { + throw parser_exception("Invalid initiator ID: '" + initiator + "' (0-7)"); } if (target_id == -1 && !reset_bus) {