check MapActivity reference on null

This commit is contained in:
Nazar-Kutz 2020-04-30 11:24:30 +03:00
parent 4b6d0b28eb
commit cfea326efc

View file

@ -160,10 +160,13 @@ public class AmenityMenuController extends MenuController {
public String getNameStr() { public String getNameStr() {
String preferredLang = getPreferredMapLang(); String preferredLang = getPreferredMapLang();
if (amenity.getType().isWiki()) { if (amenity.getType().isWiki()) {
OsmandApplication app = getMapActivity().getMyApplication(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
OsmandApplication app = mapActivity.getMyApplication();
preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app, preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app,
amenity.getSupportedContentLocales(), getPreferredMapAppLang()); amenity.getSupportedContentLocales(), getPreferredMapAppLang());
} }
}
String name = amenity.getName(preferredLang, isTransliterateNames()); String name = amenity.getName(preferredLang, isTransliterateNames());
Map<String, String> additionalInfo = amenity.getAdditionalInfo(); Map<String, String> additionalInfo = amenity.getAdditionalInfo();
if (additionalInfo != null) { if (additionalInfo != null) {