Fix possible NPE, remove unnecessary track visibility set

This commit is contained in:
androiddevkotlin 2021-04-12 21:37:41 +03:00
parent 3a5e8c6230
commit c3ee44ffac
2 changed files with 12 additions and 10 deletions

View file

@ -257,10 +257,11 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
getMyApplication().getTravelHelper().createGpxFile(article);
GPXFile gpxFile = article.getGpxFile();
if (saved) {
if (gpxFile != null) {
getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
}
helper.removeArticleFromSaved(article);
} else {
getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxFile, true, true);
helper.addArticleToSaved(article);
}
updateSaveButton();

View file

@ -107,10 +107,11 @@ public class ArticleTravelCard extends BaseTravelCard {
app.getTravelHelper().createGpxFile(article);
GPXFile gpxFile = article.getGpxFile();
if (saved) {
if (gpxFile != null) {
app.getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
}
helper.removeArticleFromSaved(article);
} else {
app.getSelectedGpxHelper().selectGpxFile(gpxFile, true, true);
helper.addArticleToSaved(article);
}
updateSaveButton(holder);