Merge pull request #4219 from osmandapp/npe_track_segment_fragment
Fix NPE in track segment
This commit is contained in:
commit
4e6a8f0e61
1 changed files with 12 additions and 2 deletions
|
@ -278,14 +278,24 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
WptPt pointToShow = getGpx() != null ? getGpx().findPointToShow() : null;
|
||||
GpxDataItem gpxDataItem = getGpxDataItem();
|
||||
GPXFile gpx = getGpx();
|
||||
WptPt pointToShow = gpx != null ? gpx.findPointToShow() : null;
|
||||
if (pointToShow != null) {
|
||||
LatLon location = new LatLon(pointToShow.getLatitude(),
|
||||
pointToShow.getLongitude());
|
||||
final OsmandSettings settings = app.getSettings();
|
||||
String trackName = "";
|
||||
if (gpx.showCurrentTrack) {
|
||||
trackName = getString(R.string.shared_string_currently_recording_track);
|
||||
} else if (gpxDataItem != null) {
|
||||
trackName = gpxDataItem.getFile().getName();
|
||||
} else {
|
||||
trackName = gpx.path;
|
||||
}
|
||||
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
||||
settings.getLastKnownMapZoom(),
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, getGpxDataItem().getFile().getName()),
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, trackName),
|
||||
false,
|
||||
getRect()
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue