mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
b6e982b925
commit
7436980605
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user