mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 00:19:02 +08:00
Bugfix: prevent crash when setting a Choice field to a non-indexed value
This commit is contained in:
parent
48f1fab49f
commit
5844b956be
@ -239,8 +239,13 @@ sub set_value {
|
||||
|
||||
$self->disable_change_event(1);
|
||||
|
||||
my $idx;
|
||||
if ($self->option->values) {
|
||||
my $idx = first { $self->option->values->[$_] eq $value } 0..$#{$self->option->values};
|
||||
$idx = first { $self->option->values->[$_] eq $value } 0..$#{$self->option->values};
|
||||
# if value is not among indexes values we use SetValue()
|
||||
}
|
||||
|
||||
if (defined $idx) {
|
||||
$self->wxWindow->SetSelection($idx);
|
||||
} else {
|
||||
$self->wxWindow->SetValue($value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user