aminography / ChoosePhotoHelper

ChoosePhotoHelper develops a component which facilitates the source code of picking photos in your Android apps.
Apache License 2.0
57 stars 26 forks source link

Crash if one permission granted and then grant second permission when try to launch camera #19

Closed Podox2 closed 3 years ago

Podox2 commented 3 years ago

There is next code in onRequestPermissionsResult() for camera:

if ((grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED)) { onPermissionsGranted(requestCode) }

But in grantResults[] will be only one object and java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 will be thrown.

Simple fix is check is grantResults[] has only one object.

aminography commented 3 years ago

Hi @Podox2 Thank you for reporting the issue. I will fix it soon.