Fix QuickSearchListItem crash

This commit is contained in:
Alexey Kulish 2016-11-19 17:21:32 +03:00
parent 11abd18dcb
commit 67c941eb43

View file

@ -321,7 +321,7 @@ public class QuickSearchListItem {
iconId = R.drawable.mx_user_defined; iconId = R.drawable.mx_user_defined;
} }
} }
if (iconId != -1) { if (iconId > 0) {
return app.getIconsCache().getIcon(iconId, return app.getIconsCache().getIcon(iconId,
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
} else { } else {
@ -332,8 +332,12 @@ public class QuickSearchListItem {
String id = getAmenityIconName(amenity); String id = getAmenityIconName(amenity);
if (id != null) { if (id != null) {
iconId = RenderingIcons.getBigIconResourceId(id); iconId = RenderingIcons.getBigIconResourceId(id);
return app.getIconsCache().getIcon(iconId, if (iconId > 0) {
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); return app.getIconsCache().getIcon(iconId,
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
} else {
return null;
}
} else { } else {
return null; return null;
} }
@ -356,7 +360,7 @@ public class QuickSearchListItem {
iconId = app.getResources().getIdentifier(iconName, "drawable", app.getPackageName()); iconId = app.getResources().getIdentifier(iconName, "drawable", app.getPackageName());
} }
} }
if (iconId == -1) { if (iconId <= 0) {
return app.getIconsCache().getIcon(SearchHistoryFragment.getItemIcon(entry.getName()), return app.getIconsCache().getIcon(SearchHistoryFragment.getItemIcon(entry.getName()),
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
} else { } else {