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

Commit e978018e authored by MarcKe's avatar MarcKe
Browse files

healthd: fix LED color on 100%

if soc reaches 100, the loop variable would reach 3.
acessing the the fourth element of soc_leds is undefined behaviour

Change-Id: Iebc521c66844c811afa0244bc7977d1f88144227
parent 210b74a7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ static int set_battery_soc_leds(int soc)
    static int old_color = 0;

    for (i = 0; i < (int)ARRAY_SIZE(soc_leds); i++) {
        if (soc < soc_leds[i].soc)
        if (soc <= soc_leds[i].soc)
            break;
    }
    color = soc_leds[i].color;