From f29ace45444cbd6ffd938b37937133fdd8eb5593 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 23 Feb 2018 18:03:47 +0200 Subject: [PATCH] fixed nullPointerException and removed current downloading text from contentText --- .../plus/download/DownloadIndexesThread.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 65beecac88..b2c7dc3038 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -119,14 +119,22 @@ public class DownloadIndexesThread { } StringBuilder contentText = new StringBuilder(); List ii = getCurrentDownloadingItems(); - for(IndexItem i : ii) { - if(contentText.length() > 0) { + for (IndexItem i : ii) { + if (contentText.length() > 0) { contentText.append(", "); } + if (i == currentDownloadingItem) { + continue; + } contentText.append(i.getVisibleName(app, app.getRegions())); - contentText.append(" ").append(i.getType().getString(app)); + if (i.getType() != null) { + contentText.append(" ").append(i.getType().getString(app)); + } } - bld.setContentTitle(msg+" "+currentDownloadingItem.getType().getString(app)).setSmallIcon(android.R.drawable.stat_sys_download) + if (currentDownloadingItem != null) { + msg += " " + currentDownloadingItem.getType().getString(app); + } + bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentText(contentText.toString()) .setContentIntent(contentPendingIntent).setOngoing(true);