From 99eadd7609f1fa0e905f4239405ec63b24e992a0 Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Tue, 22 Sep 2026 13:40:42 +0300 Subject: [PATCH] SHELL: do not index an empty selection when the command starts `bool::then_some` evaluates its argument eagerly, so starting SHELL or SOLIDEDIT with nothing selected indexed an empty vector and aborted the application. The single-solid target now comes from a slice match. Co-Authored-By: Claude Fable 5.1 --- src/app/commands/draw.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/commands/draw.rs b/src/app/commands/draw.rs index c51425fc7..cd0655e1c 100644 --- a/src/app/commands/draw.rs +++ b/src/app/commands/draw.rs @@ -2006,7 +2006,13 @@ impl OpenCADStudio { ) }) .collect::>(); - let target = (selected.len() == 1).then_some(selected[0]); + // `then_some` evaluates its argument eagerly: indexing an empty + // selection here crashed the app when SHELL was started with + // nothing selected. + let target = match selected.as_slice() { + [handle] => Some(*handle), + _ => None, + }; let new_cmd = if cmd == "SHELL" { ShellCommand::direct(target) } else {