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

Commit aeaa9cf5 authored by Tyler Wear's avatar Tyler Wear
Browse files

NetworkStats: Avoid Division By 0

RawBytes should always be at least 1 to avoid division by 0 and
ArithmeticException resulting in Settings crash.

Bug: 197292638
Change-Id: I4e5ac9da7adf707d7f991483555ab5c6d0cc3245
parent 98d3db87
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -285,7 +285,8 @@ public class NetworkStatsCollection implements FileRotator.Reader, FileRotator.W
                combined.getValues(augmentStart, augmentEnd, entry);
            }

            final long rawBytes = entry.rxBytes + entry.txBytes;
            final long rawBytes = (entry.rxBytes + entry.txBytes) == 0 ? 1 :
                    (entry.rxBytes + entry.txBytes);
            final long rawRxBytes = entry.rxBytes == 0 ? 1 : entry.rxBytes;
            final long rawTxBytes = entry.txBytes == 0 ? 1 : entry.txBytes;
            final long targetBytes = augmentPlan.getDataUsageBytes();