Bug 920507 - Uncaught exception / crash when Clear private data -> Browsing & download history, r=lucasr
authorMark Capella <markcapella@twcny.rr.com>
Sat, 19 Oct 2013 02:10:20 -0400
changeset 165226 eeee2c0ca5ffefc5df3aae5d17a2a20796ebd1a9
parent 165225 321e817596d2f319f1dac70b400bd13b7ef9226f
child 165227 b106a15a50eed323515f28a5c70c79e6cacea8bc
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs920507
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 920507 - Uncaught exception / crash when Clear private data -> Browsing & download history, r=lucasr
mobile/android/base/home/MostRecentPage.java
--- a/mobile/android/base/home/MostRecentPage.java
+++ b/mobile/android/base/home/MostRecentPage.java
@@ -231,18 +231,18 @@ public class MostRecentPage extends Home
         @Override
         public int getCount() {
             // Add the history section headers to the number of reported results.
             return super.getCount() + mMostRecentSections.size();
         }
 
         @Override
         public Cursor swapCursor(Cursor cursor) {
+            loadMostRecentSections(cursor);
             Cursor oldCursor = super.swapCursor(cursor);
-            loadMostRecentSections(cursor);
             return oldCursor;
         }
 
         @Override
         public void bindView(View view, Context context, int position) {
             final int type = getItemViewType(position);
 
             if (type == ROW_HEADER) {
@@ -304,23 +304,23 @@ public class MostRecentPage extends Home
             if (delta < MS_PER_WEEK) {
                 return MostRecentSection.WEEK;
             }
 
             return MostRecentSection.OLDER;
         }
 
         private void loadMostRecentSections(Cursor c) {
+            // Clear any history sections that may have been loaded before.
+            mMostRecentSections.clear();
+
             if (c == null || !c.moveToFirst()) {
                 return;
             }
 
-            // Clear any history sections that may have been loaded before.
-            mMostRecentSections.clear();
-
             final Date now = new Date();
             now.setHours(0);
             now.setMinutes(0);
             now.setSeconds(0);
 
             final long today = now.getTime();
             MostRecentSection section = null;
 
@@ -353,10 +353,10 @@ public class MostRecentPage extends Home
             mAdapter.swapCursor(c);
             updateUiFromCursor(c);
         }
 
         @Override
         public void onLoaderReset(Loader<Cursor> loader) {
             mAdapter.swapCursor(null);
         }
-   }
+    }
 }