apps-android-commons: [Bug]: Attempt to read from null error in Explore -> Map fragment
Summary
This issue is caused when there are no elements in mediaList Maybe the issue caused when there are no media (images) available at specific coordinate.
Steps to reproduce
- Open Explore -> Map Fragment in App
- Go to Bihta, Patna, India or Coordinates = 25.5303740, 84.8597150 in map
Expected behaviour
Placeโs images should appear on the map.
Actual behaviour
Toast message Error fetching nearby places. Attempt to read from null...
Device name
Samsung S21
Android version
Android 14
Commons app version
4.2.1-debug-HEAD~9be8df3
Device logs
java.lang.NullPointerException: Attempt to read from null array at fr.free.nrw.commons.explore.map.ExploreMapPresenter.getLatLngBounds(ExploreMapPresenter.java:223) at fr.free.nrw.commons.explore.map.ExploreMapPresenter.updateMapMarkers(ExploreMapPresenter.java:193) at fr.free.nrw.commons.explore.map.ExploreMapFragment.updateMapMarkers(ExploreMapFragment.java:433) at fr.free.nrw.commons.explore.map.ExploreMapFragment.lambda$populatePlaces$5$fr-free-nrw-commons-explore-map-ExploreMapFragment(ExploreMapFragment.java:413)
Screen-shots
Would you like to work on the issue?
Yes
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 21 (11 by maintainers)
Thanks @ShashwatKedia it worked! on production server. But we will need to handle it since there can be a place on earth where are no images in that case there will be this error. So, we can show some dialog at that place to make user experience better.
Done Mr. @kanahia1 ๐
Sure @rohit9625 I will look into #5487
Hey @rohit9625, I have added TODO for snackbar in https://github.com/commons-app/apps-android-commons/pull/5475, you can add code for snackbar and share a pull request. ๐
@rohit9625 Your screenshot looks great! ๐
Ah wait, I was totally forgetting the context since yesterday, I am so sorry! ๐ฑ
Please use โNo pictures in this areaโ.
Thanks! ๐
Indeed, I just tried with prodDebug in Siberia and get the same error:
@kanahia1 this might happen because you are using the betaDebug variant, as was the case here https://github.com/commons-app/apps-android-commons/issues/5255#issuecomment-1890995267, pointed out by @nicolas-raoul here: https://github.com/commons-app/apps-android-commons/issues/5255#issuecomment-1891572569. Does the issue persist in prodDebug variant as well?