Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef009cc8 authored by Raff Tsai's avatar Raff Tsai Committed by Tsung-Mao Fang
Browse files

Fix volume panel crashing

slider position is smaller than min value causes the exception.
Fixed by limit the position within min and max value.

Fixes: 148270968
Fixes: 149973990
Test: manual
Change-Id: I3d162f6d2f1035b81b1b2eb915b488084e7ea36e
(cherry picked from commit fcd9f1a8)
Merged-In: I3d162f6d2f1035b81b1b2eb915b488084e7ea36e
parent 936ebd03
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -313,6 +313,14 @@ public class SliceBuilderUtils {
                ListBuilder.ICON_IMAGE, sliceData.getTitle());
        final Set<String> keywords = buildSliceKeywords(sliceData);

        int cur = sliderController.getSliderPosition();
        if (cur < sliderController.getMin()) {
            cur = sliderController.getMin();
        }
        if (cur > sliderController.getMax()) {
            cur = sliderController.getMax();
        }

        return new ListBuilder(context, sliceData.getUri(), ListBuilder.INFINITY)
                .setAccentColor(color)
                .addInputRange(new InputRangeBuilder()
@@ -321,7 +329,7 @@ public class SliceBuilderUtils {
                        .setPrimaryAction(primaryAction)
                        .setMax(sliderController.getMax())
                        .setMin(sliderController.getMin())
                        .setValue(sliderController.getSliderPosition())
                        .setValue(cur)
                        .setInputAction(actionIntent))
                .setKeywords(keywords)
                .build();