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