From a010ef4d7edff4f651d3a7706f244771e2479a29 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 2 Sep 2009 13:24:52 -0700 Subject: [PATCH] Cleaner way to fix the -1 count problem (and removing an Eclipse warning along the way). Change-Id: I154e27f615932bfcc08993aa361a6d2ffbc51d74 --- core/java/android/provider/Gmail.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/java/android/provider/Gmail.java b/core/java/android/provider/Gmail.java index 157b1c889eee1..073ae6c294411 100644 --- a/core/java/android/provider/Gmail.java +++ b/core/java/android/provider/Gmail.java @@ -1548,11 +1548,12 @@ public final class Gmail { getLabelIdValues(labelId).getAsInteger(LabelColumns.NUM_UNREAD_CONVERSATIONS); // There seems to be a race condition here that can get the label maps into a bad // state and lose state on a particular label. - if (unreadConversations == null) { - return 0; - } else { - return unreadConversations < 0 ? 0 : unreadConversations; + int result = 0; + if (unreadConversations != null) { + result = unreadConversations < 0 ? 0 : unreadConversations; } + + return result; } /**