1
0
Fork 1

Avoid crashes due to setting value outside of range

In case of bad value

(cherry picked from commit ce44735aeb123dcf10fefce6922cb886cab89b86)
This commit is contained in:
Stephen Paul Weber 2024-09-18 13:37:05 -05:00 committed by Arne
parent 0c841f1aa3
commit 3975c0befa

View file

@ -2538,7 +2538,12 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
if (field.getValues().size() > 0) {
binding.slider.setValue(Float.valueOf(field.getValue().getContent()));
final var val = Float.valueOf(field.getValue().getContent());
if ((min == null || val >= min) && (max == null || val <= max)) {
binding.slider.setValue(Float.valueOf(field.getValue().getContent()));
} else {
binding.slider.setValue(min == null ? Float.MIN_VALUE : min);
}
} else {
binding.slider.setValue(min == null ? Float.MIN_VALUE : min);
}