Fix possible npe
This commit is contained in:
parent
bf59a702e5
commit
f543d40b1a
2 changed files with 12 additions and 4 deletions
|
@ -7,6 +7,7 @@ import android.graphics.BitmapFactory;
|
|||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
|
@ -89,6 +90,7 @@ public class FavouritePoint implements Serializable, LocationPoint {
|
|||
return color;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment;
|
|||
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragmentNew;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
import net.osmand.view.GravityDrawable;
|
||||
|
||||
|
@ -160,11 +161,16 @@ public class FavouritePointMenuController extends MenuController {
|
|||
@NonNull
|
||||
@Override
|
||||
public CharSequence getSubtypeStr() {
|
||||
Typeface typeface = FontCache.getRobotoRegular(getMapActivity());
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null && !Algorithms.isEmpty(fav.getAddress())) {
|
||||
Typeface typeface = FontCache.getRobotoRegular(mapActivity);
|
||||
SpannableString addressSpannable = new SpannableString(fav.getAddress());
|
||||
addressSpannable.setSpan(new CustomTypefaceSpan(typeface), 0, addressSpannable.length(), 0);
|
||||
|
||||
return addressSpannable;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue