From 260d4eede23f2818b0bde79f15c02932dc3e2f6d Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 10 Nov 2014 11:11:26 +0200 Subject: [PATCH] Fixed NPE in UpdatesIntexFragment --- .../src/net/osmand/plus/download/UpdatesIndexFragment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java index f666b9196f..336367be19 100644 --- a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java @@ -41,7 +41,12 @@ public class UpdatesIndexFragment extends SherlockListFragment { format = getMyApplication().getResourceManager().getDateFormat(); updateColor = getResources().getColor(R.color.color_update); osmandRegions = getMyApplication().getResourceManager().getOsmandRegions(); - listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, DownloadActivity.downloadListIndexThread.getItemsToUpdate()); + List indexItems = new ArrayList(); + if (DownloadActivity.downloadListIndexThread != null && + DownloadActivity.downloadListIndexThread.getItemsToUpdate() != null) { + indexItems = DownloadActivity.downloadListIndexThread.getItemsToUpdate(); + } + listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, indexItems); listAdapter.sort(new Comparator() { @Override public int compare(IndexItem indexItem, IndexItem indexItem2) {