first check if element exist, then access it

This commit is contained in:
AdrianLxM 2016-11-25 12:49:41 +01:00 committed by AdrianLxM
parent 39be1bb4c7
commit b2d2f462f6

View file

@ -244,8 +244,8 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(ActivityCompat.checkSelfPermission(this, permissions[0]) == PackageManager.PERMISSION_GRANTED){
if (permissions.length != 0) {
if (ActivityCompat.checkSelfPermission(this, permissions[0]) == PackageManager.PERMISSION_GRANTED) {
switch (requestCode) {
case CASE_STORAGE:
//show dialog after permission is granted