mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Check that fragment is added to activity to prevent crash
This commit is contained in:
		
							parent
							
								
									05044d4b9a
								
							
						
					
					
						commit
						dc06fe789f
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		|  | @ -70,6 +70,9 @@ public class ContributionController { | |||
|         requestWritePermission(fragment.getContext(), takePictureIntent, lastGeneratedCaptureUri); | ||||
| 
 | ||||
|         takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, lastGeneratedCaptureUri); | ||||
|         if (!fragment.isAdded()) { | ||||
|             return; | ||||
|         } | ||||
|         fragment.startActivityForResult(takePictureIntent, SELECT_FROM_CAMERA); | ||||
|     } | ||||
| 
 | ||||
|  | @ -79,6 +82,9 @@ public class ContributionController { | |||
|         pickImageIntent.setType("image/*"); | ||||
|         Timber.d("startGalleryPick() called with pickImageIntent"); | ||||
|         //TODO Add fix for IllegalStateException here | ||||
|         if (!fragment.isAdded()) { | ||||
|             return; | ||||
|         } | ||||
|         fragment.startActivityForResult(pickImageIntent, SELECT_FROM_GALLERY); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 misaochan
						misaochan