Skip to content

Commit c292c23

Browse files
Daniel LangeDaniel Lange
authored andcommitted
Merge branch 'dbz-fix' of mugitya03/htop
2 parents 80e4532 + 98f0a11 commit c292c23

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

netbsd/Platform.c

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

518517
error:
519518
if (fd != -1)

0 commit comments

Comments
 (0)