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,11 +332,15 @@ 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);
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 {
return null; return null;
} }
} else {
return null;
}
case LOCATION: case LOCATION:
return app.getIconsCache().getIcon(R.drawable.ic_action_world_globe, return app.getIconsCache().getIcon(R.drawable.ic_action_world_globe,
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark); app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
@ -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 {