Skip to content

Commit 98f0a11

Browse files
mugitya03BenBE
andauthored
check totalCapacity before use it as a divisor
Co-authored-by: BenBE <[email protected]>
1 parent e6ebd45 commit 98f0a11

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

netbsd/Platform.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,7 @@ void Platform_getBattery(double* percent, ACPresence* isOnAC) {
512512
*isOnAC = isConnected ? AC_PRESENT : AC_ABSENT;
513513
}
514514
}
515-
*percent = (totalCapacity > 0)
516-
? ((double)totalCharge / (double)totalCapacity) * 100.0
517-
: NAN;
515+
*percent = totalCapacity > 0 ? ((double)totalCharge / (double)totalCapacity) * 100.0 : NAN;
518516

519517
error:
520518
if (fd != -1)

0 commit comments

Comments
 (0)