Merge pull request #9038 from osmandapp/getPoiTypeIconName_npe

fix NPE
This commit is contained in:
max-klaus 2020-05-21 11:23:00 +03:00 committed by GitHub
commit aa778cb289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import net.osmand.binary.BinaryMapIndexReader;
@ -279,8 +280,9 @@ public class QuickSearchListItem {
return getIcon(app, searchResult);
}
@Nullable
public static String getPoiTypeIconName(AbstractPoiType abstractPoiType) {
if (RenderingIcons.containsBigIcon(abstractPoiType.getIconKeyName())) {
if (abstractPoiType != null && RenderingIcons.containsBigIcon(abstractPoiType.getIconKeyName())) {
return abstractPoiType.getIconKeyName();
} else if (abstractPoiType instanceof PoiType
&& RenderingIcons.containsBigIcon(