Bug 1041448 - Fix crash when double-tapping on empty top site spot. r=bnicholson, a=lmandel
authorLucas Rocha <lucasr@mozilla.com>
Tue, 09 Sep 2014 11:04:12 +0100
changeset 224791 f5b683c6c69aed320bf72e0bcdcd964c15c3f694
parent 224790 d1f86b92be8d084f96c820df2fbd98d908f49593
child 224792 cc4c10c8580d3e8ec70292237661f18fb810c96f
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, lmandel
bugs1041448
milestone34.0a2
Bug 1041448 - Fix crash when double-tapping on empty top site spot. r=bnicholson, a=lmandel
mobile/android/base/home/TopSitesPanel.java
--- a/mobile/android/base/home/TopSitesPanel.java
+++ b/mobile/android/base/home/TopSitesPanel.java
@@ -356,27 +356,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