зеркало из https://github.com/mozilla/gecko-dev.git
Bug 697528 - Fix NPE when history is empty (r=lucasr)
If the history is empty, then some data structures don't get initialized and this results in an NPE. Ensure that the data structures wherever used, and do an early exit so we don't uselessly run code when the history is empty.
This commit is contained in:
Родитель
d77bc49e63
Коммит
a896111996
|
@ -294,14 +294,14 @@ public class AwesomeBarTabs extends TabHost {
|
|||
long time = cursor.getLong(cursor.getColumnIndexOrThrow(Browser.BookmarkColumns.DATE));
|
||||
HistorySection itemSection = getSectionForTime(time, today);
|
||||
|
||||
if (groups == null)
|
||||
groups = new LinkedList<Map<String,?>>();
|
||||
|
||||
if (childrenLists == null)
|
||||
childrenLists = new LinkedList<List<Map<String,?>>>();
|
||||
|
||||
if (section != itemSection) {
|
||||
if (section != null) {
|
||||
if (groups == null)
|
||||
groups = new LinkedList<Map<String,?>>();
|
||||
|
||||
if (childrenLists == null)
|
||||
childrenLists = new LinkedList<List<Map<String,?>>>();
|
||||
|
||||
groups.add(createGroupItem(section));
|
||||
childrenLists.add(children);
|
||||
}
|
||||
|
@ -323,6 +323,10 @@ public class AwesomeBarTabs extends TabHost {
|
|||
// Close the query cursor as we won't use it anymore
|
||||
cursor.close();
|
||||
|
||||
// FIXME: display some sort of message when there's no history
|
||||
if (groups == null)
|
||||
return;
|
||||
|
||||
mHistoryAdapter = new HistoryListAdapter(
|
||||
mContext,
|
||||
groups,
|
||||
|
|
Загрузка…
Ссылка в новой задаче