From 67c941eb43311543159a69d1dcad8457df068e8c Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sat, 19 Nov 2016 17:21:32 +0300 Subject: [PATCH] Fix QuickSearchListItem crash --- .../net/osmand/plus/search/QuickSearchListItem.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java index 1c76f05b9f..7f371a17ff 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java @@ -321,7 +321,7 @@ public class QuickSearchListItem { iconId = R.drawable.mx_user_defined; } } - if (iconId != -1) { + if (iconId > 0) { return app.getIconsCache().getIcon(iconId, app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); } else { @@ -332,8 +332,12 @@ public class QuickSearchListItem { String id = getAmenityIconName(amenity); if (id != null) { iconId = RenderingIcons.getBigIconResourceId(id); - return app.getIconsCache().getIcon(iconId, - app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); + if (iconId > 0) { + return app.getIconsCache().getIcon(iconId, + app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); + } else { + return null; + } } else { return null; } @@ -356,7 +360,7 @@ public class QuickSearchListItem { iconId = app.getResources().getIdentifier(iconName, "drawable", app.getPackageName()); } } - if (iconId == -1) { + if (iconId <= 0) { return app.getIconsCache().getIcon(SearchHistoryFragment.getItemIcon(entry.getName()), app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); } else {