Fix npe
This commit is contained in:
parent
28596321c6
commit
8098f5d92c
1 changed files with 13 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.wikivoyage.article;
|
package net.osmand.plus.wikivoyage.article;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -339,19 +340,22 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTrackButton(boolean processing, @Nullable GPXFile gpxFile) {
|
private void updateTrackButton(boolean processing, @Nullable GPXFile gpxFile) {
|
||||||
|
Context ctx = getContext();
|
||||||
|
if (ctx != null) {
|
||||||
if (processing) {
|
if (processing) {
|
||||||
trackButton.setVisibility(View.GONE);
|
trackButton.setVisibility(View.GONE);
|
||||||
gpxProgress.setVisibility(View.VISIBLE);
|
gpxProgress.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
if (gpxFile != null && gpxFile.getPointsSize() > 0) {
|
if (gpxFile != null && gpxFile.getPointsSize() > 0) {
|
||||||
trackButton.setVisibility(View.VISIBLE);
|
trackButton.setVisibility(View.VISIBLE);
|
||||||
trackButton.setText(getString(R.string.shared_string_gpx_points) + " (" + gpxFile.getPointsSize() + ")");
|
trackButton.setText(ctx.getString(R.string.shared_string_gpx_points) + " (" + gpxFile.getPointsSize() + ")");
|
||||||
} else {
|
} else {
|
||||||
trackButton.setVisibility(View.GONE);
|
trackButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
gpxProgress.setVisibility(View.GONE);
|
gpxProgress.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue