mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	nearby: make sure places is initialized (#5241)
On taking a look at the following stack trace: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference at fr.free.nrw.commons.nearby.fragments.NearbyParentFragment.updatePlaceList(NearbyParentFragment.java:777) at fr.free.nrw.commons.nearby.fragments.NearbyParentFragment.lambda$initFilterChips$10$NearbyParentFragment(NearbyParentFragment.java:730) at fr.free.nrw.commons.nearby.fragments.-$$Lambda$NearbyParentFragment$AGol6SoJlvIYd45Vbz6tTjDiWU4.onCheckedChanged(Unknown Source:2) at android.widget.CompoundButton.setChecked(CompoundButton.java:235) at com.google.android.material.chip.Chip.setChecked(Chip.java:665) at android.widget.CompoundButton.toggle(CompoundButton.java:150) ... ... it seems clear the 'places' list is trying to be iterated in the updatePlaceList method when it is empty. This is resulting in an NPE and consequently an app crash. Avoid the same by ensuring it is always initialized to an empty list.
This commit is contained in:
		
							parent
							
								
									00b69c6731
								
							
						
					
					
						commit
						f4e8de79fb
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -259,7 +259,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment | |||
|     /** | ||||
|      * Saves response of list of places for the first time | ||||
|      */ | ||||
|     private List<Place> places; | ||||
|     private List<Place> places = new ArrayList<>(); | ||||
| 
 | ||||
|     @NonNull | ||||
|     public static NearbyParentFragment newInstance() { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kaartic Sivaraam
						Kaartic Sivaraam