Fix fav group image npe

This commit is contained in:
max-klaus 2020-09-21 12:17:45 +03:00
parent 3eef30e12a
commit 17351e2e88
2 changed files with 4 additions and 2 deletions

View file

@ -129,6 +129,7 @@ public class FavouritesDbHelper {
}
}
@Nullable
public Drawable getColoredIconForGroup(String groupName) {
String groupIdName = FavoriteGroup.convertDisplayNameToGroupIdName(context, groupName);
FavoriteGroup favoriteGroup = getGroup(groupIdName);

View file

@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
import android.text.SpannableString;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
@ -180,8 +181,8 @@ public class FavouritePointMenuController extends MenuController {
OsmandApplication app = mapActivity.getMyApplication();
FavouritesDbHelper helper = app.getFavorites();
String group = fav.getCategory();
if (helper.getGroup(group) != null) {
Drawable line2icon = helper.getColoredIconForGroup(group);
Drawable line2icon = helper.getGroup(group) != null ? helper.getColoredIconForGroup(group) : null;
if (line2icon != null) {
GravityDrawable gravityIcon = new GravityDrawable(line2icon);
gravityIcon.setBoundsFrom(line2icon);
return gravityIcon;