Fix 'Open track' button of newly created Waypoint

This commit is contained in:
cepprice 2021-03-23 12:13:00 +05:00
parent 513cce6304
commit 7c9bdb70f1

View file

@ -213,6 +213,7 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
String description = Algorithms.isEmpty(getDescriptionTextValue()) ? null : getDescriptionTextValue(); String description = Algorithms.isEmpty(getDescriptionTextValue()) ? null : getDescriptionTextValue();
if (editor.isNew()) { if (editor.isNew()) {
doAddWpt(name, category, description); doAddWpt(name, category, description);
wpt = getWpt();
} else { } else {
doUpdateWpt(name, category, description); doUpdateWpt(name, category, description);
} }
@ -222,7 +223,7 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
} }
MapContextMenu menu = mapActivity.getContextMenu(); MapContextMenu menu = mapActivity.getContextMenu();
if (menu.getLatLon() != null && menu.isActive()) { if (menu.getLatLon() != null && menu.isActive() && wpt != null) {
LatLon latLon = new LatLon(wpt.getLatitude(), wpt.getLongitude()); LatLon latLon = new LatLon(wpt.getLatitude(), wpt.getLongitude());
if (menu.getLatLon().equals(latLon)) { if (menu.getLatLon().equals(latLon)) {
menu.update(latLon, new WptLocationPoint(wpt).getPointDescription(mapActivity), wpt); menu.update(latLon, new WptLocationPoint(wpt).getPointDescription(mapActivity), wpt);