Skip to content

Commit bff9231

Browse files
Fix NullPointer when clicking on image in MediaDetailFragment (#3730)… (#3739)
1 parent 63018fc commit bff9231

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ && getParentFragment() instanceof MediaDetailPagerFragment) {
209209

210210
@OnClick(R.id.mediaDetailImageViewSpacer)
211211
public void launchZoomActivity(View view) {
212-
Context ctx = view.getContext();
213-
ctx.startActivity(
214-
new Intent(ctx,ZoomableActivity.class).setData(Uri.parse(media.getImageUrl()))
215-
);
212+
if (media.getImageUrl() != null) {
213+
Context ctx = view.getContext();
214+
ctx.startActivity(
215+
new Intent(ctx, ZoomableActivity.class).setData(Uri.parse(media.getImageUrl()))
216+
);
217+
}
216218
}
217219

218220
@Override

app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,9 +1120,7 @@ public void filterMarkersByLabels(List<Label> selectedLabels,
11201120
boolean filterForPlaceState,
11211121
boolean filterForAllNoneType) {
11221122

1123-
// Remove the previous markers before updating them
11241123
hideAllMarkers();
1125-
11261124
for (MarkerPlaceGroup markerPlaceGroup : NearbyController.markerLabelList) {
11271125
Place place = markerPlaceGroup.getPlace();
11281126

@@ -1217,7 +1215,7 @@ public void updateMarker(boolean isBookmarked, Place place, @Nullable fr.free.nr
12171215
* since grey icon may lead the users to believe that it is disabled or prohibited contribution
12181216
*/
12191217

1220-
private void hideAllMArkers() {
1218+
private void hideAllMarkers() {
12211219
VectorDrawableCompat vectorDrawable;
12221220
vectorDrawable = VectorDrawableCompat.create(
12231221
getContext().getResources(), R.drawable.ic_custom_greyed_out_marker, getContext().getTheme());

0 commit comments

Comments
 (0)