Fix possible NPE, remove unnecessary track visibility set
This commit is contained in:
parent
3a5e8c6230
commit
c3ee44ffac
2 changed files with 12 additions and 10 deletions
|
@ -254,17 +254,18 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
|
|||
saveBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getMyApplication().getTravelHelper().createGpxFile(article);
|
||||
GPXFile gpxFile = article.getGpxFile();
|
||||
if (saved) {
|
||||
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();
|
||||
helper.removeArticleFromSaved(article);
|
||||
} else {
|
||||
helper.addArticleToSaved(article);
|
||||
}
|
||||
updateSaveButton();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,10 +107,11 @@ public class ArticleTravelCard extends BaseTravelCard {
|
|||
app.getTravelHelper().createGpxFile(article);
|
||||
GPXFile gpxFile = article.getGpxFile();
|
||||
if (saved) {
|
||||
app.getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
|
||||
if (gpxFile != null) {
|
||||
app.getSelectedGpxHelper().selectGpxFile(gpxFile, false, true);
|
||||
}
|
||||
helper.removeArticleFromSaved(article);
|
||||
} else {
|
||||
app.getSelectedGpxHelper().selectGpxFile(gpxFile, true, true);
|
||||
helper.addArticleToSaved(article);
|
||||
}
|
||||
updateSaveButton(holder);
|
||||
|
|
Loading…
Reference in a new issue