From fdfeb8d3c340c941d94d2721231bb1a5dc045540 Mon Sep 17 00:00:00 2001 From: Ben Komalo Date: Thu, 26 May 2011 11:14:05 -0700 Subject: [PATCH] Prevent NPE in MessageCompose. New actionBar code makes removeAllTabs() not safe when there are no tabs. Change-Id: I9ac09c71872c5f2aaad7b8e3cf5dbe0caac6f8ef --- src/com/android/email/activity/MessageCompose.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/email/activity/MessageCompose.java b/src/com/android/email/activity/MessageCompose.java index 749cae57b..7749f2fca 100644 --- a/src/com/android/email/activity/MessageCompose.java +++ b/src/com/android/email/activity/MessageCompose.java @@ -1603,7 +1603,10 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus if (shouldUseActionTabs()) { // Tab-based mode switching. ActionBar actionBar = getActionBar(); - actionBar.removeAllTabs(); + + if (actionBar.getTabCount() > 0) { + actionBar.removeAllTabs(); + } createAndAddTab(R.string.reply_action, ACTION_REPLY); createAndAddTab(R.string.reply_all_action, ACTION_REPLY_ALL); createAndAddTab(R.string.forward_action, ACTION_FORWARD);