From f200bedd57d2e36c73b27eb0a3a5f32c59f45e07 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 16 Jan 2026 02:45:49 -0600 Subject: [PATCH] fix: crash on invalid command-line value for `--cache` / `-e` arg (#8147) * fix: crash on invalid command-line value for --cache arg * Update utils/remote.cc Co-authored-by: Yat Ho --------- Co-authored-by: Yat Ho --- utils/remote.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/remote.cc b/utils/remote.cc index ea7b336bd..07d62697a 100644 --- a/utils/remote.cc +++ b/utils/remote.cc @@ -2878,7 +2878,15 @@ int process_args(char const* rpcurl, int argc, char const* const* argv, RemoteCo break; case 'e': - args.insert_or_assign(TR_KEY_cache_size_mib, tr_num_parse(optarg_sv).value()); + if (auto val = tr_num_parse(optarg_sv)) + { + args.insert_or_assign(TR_KEY_cache_size_mib, *val); + } + else + { + fmt::print(stderr, "Argument to '-e'/'--cache' should be an integer"); + status |= EXIT_FAILURE; + } break; case 910: