Bug 1041448 - Fix crash when double-tapping on empty top site spot. r=bnicholson, a=sledru
authorLucas Rocha <lucasr@mozilla.com>
Tue, 09 Sep 2014 11:04:12 +0100
changeset 216727 e0c49c71cc55
parent 216726 2938d6cea847
child 216728 275330447f6d
push id3892
push userryanvm@gmail.com
push date2014-09-15 14:56 +0000
treeherdermozilla-beta@cd04e5bf0fec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, sledru
bugs1041448
milestone33.0
Bug 1041448 - Fix crash when double-tapping on empty top site spot. r=bnicholson, a=sledru
mobile/android/base/home/TopSitesPanel.java
--- a/mobile/android/base/home/TopSitesPanel.java
+++ b/mobile/android/base/home/TopSitesPanel.java
@@ -393,27 +393,26 @@ public class TopSitesPanel extends HomeF
         // Tag for the PinSiteDialog fragment.
         private static final String TAG_PIN_SITE = "pin_site";
 
         // Position of the pin.
         private int mPosition;
 
         @Override
         public void onEditPinnedSite(int position, String searchTerm) {
-            mPosition = position;
-
             final FragmentManager manager = getChildFragmentManager();
             PinSiteDialog dialog = (PinSiteDialog) manager.findFragmentByTag(TAG_PIN_SITE);
             if (dialog == null) {
-                dialog = PinSiteDialog.newInstance();
-            }
+                mPosition = position;
 
-            dialog.setOnSiteSelectedListener(this);
-            dialog.setSearchTerm(searchTerm);
-            dialog.show(manager, TAG_PIN_SITE);
+                dialog = PinSiteDialog.newInstance();
+                dialog.setOnSiteSelectedListener(this);
+                dialog.setSearchTerm(searchTerm);
+                dialog.show(manager, TAG_PIN_SITE);
+            }
         }
 
         @Override
         public void onSiteSelected(final String url, final String title) {
             final int position = mPosition;
             final Context context = getActivity().getApplicationContext();
             ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override