forked from 1b-agent/opencadstudio-upstream
Merge pull request #1444 from ramox81:codex/shell-command-selection-crash
This commit is contained in:
commit
ed0cf7ba71
1 file changed
+7
-1
@@ -1989,7 +1989,13 @@ impl OpenCADStudio {
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user