diff --git a/OsmAnd/src/net/osmand/plus/GpxDbHelper.java b/OsmAnd/src/net/osmand/plus/GpxDbHelper.java index c27c74f636..8a7d886a63 100644 --- a/OsmAnd/src/net/osmand/plus/GpxDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxDbHelper.java @@ -8,10 +8,10 @@ import androidx.annotation.Nullable; import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; -import net.osmand.plus.track.GpxSplitType; import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; +import net.osmand.plus.track.GpxSplitType; import net.osmand.plus.track.GradientScaleType; import java.io.File; @@ -238,7 +238,7 @@ public class GpxDbHelper { gpxFile = readingItems.poll(); while (gpxFile != null && !isCancelled()) { GpxDataItem item = readingItemsMap.remove(gpxFile); - if (item.getFile() == null) { + if (item != null && item.getFile() == null) { item = db.getItem(gpxFile, conn); } if (isAnalyseNeeded(gpxFile, item)) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java index 1649e1ea1a..e49137c6e0 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java @@ -257,7 +257,7 @@ public class IntentHelper { if (intent.hasExtra(TrackMenuFragment.OPEN_TRACK_MENU)) { String path = intent.getStringExtra(TRACK_FILE_NAME); boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false); - TrackMenuFragment.showInstance(mapActivity, path, currentRecording); + TrackMenuFragment.showInstance(mapActivity, path, currentRecording, null); mapActivity.setIntent(null); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index a761b508f2..51e7370da6 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -1257,7 +1257,9 @@ public class MenuBuilder { controller.setOnBackButtonClickListener(new OnClickListener() { @Override public void onClick(View v) { - mapContextMenu.show(); + if (mapContextMenu != null) { + mapContextMenu.show(); + } } }); controller.setOnTitleClickListener(new OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java index 6e062829a6..1128eb0531 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java @@ -45,7 +45,9 @@ public class SelectedGpxMenuController extends MenuController { mapContextMenu.hide(false); WptPt wptPt = selectedGpxPoint.selectedPoint; LatLon latLon = new LatLon(wptPt.lat, wptPt.lon); - TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile(), latLon); + SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile(); + String path = selectedGpxFile.getGpxFile().path; + TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), latLon); } }; leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index fac88b2069..51911e8779 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -1236,11 +1236,10 @@ public class MapMarkersHelper { removeGroupActiveMarkers(group, true); return; } - for (FavouritePoint fp : favGroup.getPoints()) { + List points = new ArrayList<>(favGroup.getPoints()); + for (FavouritePoint fp : points) { addNewMarkerIfNeeded(group, groupMarkers, new LatLon(fp.getLatitude(), fp.getLongitude()), fp.getName(), fp, null); } - - } else if (group.getType() == MapMarkersGroup.GPX_TYPE) { GpxSelectionHelper gpxHelper = ctx.getSelectedGpxHelper(); File file = new File(group.getId()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java index 0c6c586bc4..406642c155 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java @@ -7,6 +7,7 @@ import android.os.AsyncTask; import android.view.ViewGroup; import com.github.scribejava.core.builder.api.DefaultApi10a; +import com.github.scribejava.core.exceptions.OAuthException; import com.github.scribejava.core.model.OAuth1AccessToken; import com.github.scribejava.core.model.OAuth1RequestToken; import com.github.scribejava.core.model.OAuthAsyncRequestCallback; @@ -171,6 +172,8 @@ public class OsmOAuthAuthorizationAdapter { log.error(e); } catch (XmlPullParserException e) { log.error(e); + } catch (OAuthException e) { + log.error(e); } app.getSettings().OSM_USER_DISPLAY_NAME.set(userName); } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 541354d67b..6776ea8354 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -1099,7 +1099,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card boolean currentRecording = file == null; String path = file != null ? file.getAbsolutePath() : null; if (context instanceof MapActivity) { - TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording); + TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null); } else { Bundle bundle = new Bundle(); bundle.putString(TRACK_FILE_NAME, path); @@ -1109,7 +1109,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card } } - public static void showInstance(@NonNull final MapActivity mapActivity, @Nullable String path, boolean showCurrentTrack) { + public static void showInstance(@NonNull final MapActivity mapActivity, @Nullable String path, + boolean showCurrentTrack, @Nullable final LatLon latLon) { OsmandApplication app = mapActivity.getMyApplication(); SelectedGpxFile selectedGpxFile; if (showCurrentTrack) { @@ -1118,7 +1119,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(path); } if (selectedGpxFile != null) { - showInstance(mapActivity, selectedGpxFile, null); + showInstance(mapActivity, selectedGpxFile, latLon); } else if (!Algorithms.isEmpty(path)) { String title = app.getString(R.string.loading_smth, ""); final ProgressDialog progress = ProgressDialog.show(mapActivity, title, app.getString(R.string.loading_data)); @@ -1132,7 +1133,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card OsmandApplication app = mapActivity.getMyApplication(); SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().selectGpxFile(result, true, false); if (selectedGpxFile != null) { - showInstance(mapActivity, selectedGpxFile, null); + showInstance(mapActivity, selectedGpxFile, latLon); } } if (progress != null && AndroidUtils.isActivityNotDestroyed(mapActivity)) {