Skip to content
Snippets Groups Projects
Unverified Commit 5af2fe01 authored by Ankit Gupta's avatar Ankit Gupta Committed by Omkar Chandorkar
Browse files

MediaPicker: Check for NPE

make sure view has been created before asking for
its visibility.

Change-Id: I0f0c36f8edf83c518bf07ef05399eda5d6b0f78a
Issue-id: FEIJ-1135
parent 281cdef6
No related branches found
No related tags found
No related merge requests found
......@@ -123,6 +123,10 @@ class AudioMediaChooser extends MediaChooser implements
final int requestCode, final String permissions[], final int[] grantResults) {
if (requestCode == MediaPicker.RECORD_AUDIO_PERMISSION_REQUEST_CODE) {
final boolean permissionGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
// onRequestPermissionsResult can sometimes get called before createView().
if (mEnabledView == null) {
return;
}
mEnabledView.setVisibility(permissionGranted ? View.VISIBLE : View.GONE);
mMissingPermissionView.setVisibility(permissionGranted ? View.GONE : View.VISIBLE);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment