Skip to content

Commit f0bbc49

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Avoid NPE when missing network stats." into ics-mr1
2 parents 840201d + d04ff11 commit f0bbc49

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

services/java/com/android/server/net/NetworkStatsService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,8 +1060,10 @@ private void removeUidLocked(int uid) {
10601060
}
10611061

10621062
// clear UID from current stats snapshot
1063-
mLastPollUidSnapshot = mLastPollUidSnapshot.withoutUid(uid);
1064-
mLastPollNetworkXtSnapshot = computeNetworkXtSnapshotFromUid(mLastPollUidSnapshot);
1063+
if (mLastPollUidSnapshot != null) {
1064+
mLastPollUidSnapshot = mLastPollUidSnapshot.withoutUid(uid);
1065+
mLastPollNetworkXtSnapshot = computeNetworkXtSnapshotFromUid(mLastPollUidSnapshot);
1066+
}
10651067

10661068
// clear kernel stats associated with UID
10671069
resetKernelUidStats(uid);

0 commit comments

Comments
 (0)