Program: 113954
Project: 113954
Buggy source:
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  MaterialDialog.Builder builder=new MaterialDialog.Builder(getActivity());
  builder.title(R.string.dlg_choose_image_from);
  String[] imagePickArray=getResources().getStringArray(R.array.dlg_image_pick);
  ArrayList<String> imagePickList=new ArrayList<>(Arrays.asList(imagePickArray));
  if (getArguments().getInt("String_Node_Str") != ImageUtils.IMAGE_LOCATION_REQUEST_CODE) {
    imagePickList.remove(2);
  }
  builder.items(imagePickList.toArray(new String[imagePickList.size()]));
  builder.itemsCallback(new MaterialDialog.ListCallback(){
    @Override public void onSelection(    MaterialDialog materialDialog,    View view,    int i,    CharSequence charSequence){
switch (i) {
case POSITION_GALLERY:
        if (systemPermissionHelper.isAllPermissionsGrantedForSaveFile()) {
          onImageSourcePickedListener.onImageSourcePicked(ImageSource.GALLERY);
        }
 else {
          systemPermissionHelper.requestPermissionsForSaveFile();
        }
      break;
case POSITION_CAMERA:
    if (systemPermissionHelper.isCameraPermissionGranted()) {
      onImageSourcePickedListener.onImageSourcePicked(ImageSource.CAMERA);
    }
 else {
      systemPermissionHelper.requestPermissionsTakePhoto();
    }
  break;
case POSITION_LOCATION:
onImageSourcePickedListener.onImageSourcePicked(ImageSource.LOCATION);
break;
}
}
}
);
MaterialDialog dialog=builder.build();
dialog.setCanceledOnTouchOutside(false);
dialog.setOnKeyListener(new DialogInterface.OnKeyListener(){
@Override public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
if ((keyCode == android.view.KeyEvent.KEYCODE_BACK)) {
getFragmentManager().popBackStack();
}
return false;
}
}
);
return dialog;
}

Fixed version (ground truth):
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  MaterialDialog.Builder builder=new MaterialDialog.Builder(getActivity());
  builder.title(R.string.dlg_choose_image_from);
  String[] imagePickArray=getResources().getStringArray(R.array.dlg_image_pick);
  ArrayList<String> imagePickList=new ArrayList<>(Arrays.asList(imagePickArray));
  if (getArguments().getInt("String_Node_Str") != ImageUtils.IMAGE_LOCATION_REQUEST_CODE) {
    imagePickList.remove(2);
  }
  builder.items(imagePickList.toArray(new String[imagePickList.size()]));
  builder.itemsCallback(new MaterialDialog.ListCallback(){
    @Override public void onSelection(    MaterialDialog materialDialog,    View view,    int i,    CharSequence charSequence){
switch (i) {
case POSITION_GALLERY:
        if (systemPermissionHelper.isAllPermissionsGrantedForSaveFile()) {
          onImageSourcePickedListener.onImageSourcePicked(ImageSource.GALLERY);
        }
 else {
          systemPermissionHelper.requestPermissionsForSaveFile();
        }
      break;
case POSITION_CAMERA:
    if (systemPermissionHelper.isCameraPermissionGranted()) {
      onImageSourcePickedListener.onImageSourcePicked(ImageSource.CAMERA);
    }
 else {
      systemPermissionHelper.requestPermissionsTakePhoto();
    }
  break;
case POSITION_LOCATION:
onImageSourcePickedListener.onImageSourcePicked(ImageSource.LOCATION);
break;
}
}
}
);
MaterialDialog dialog=builder.build();
dialog.setCanceledOnTouchOutside(false);
dialog.setOnKeyListener(new DialogInterface.OnKeyListener(){
@Override public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
if ((keyCode == android.view.KeyEvent.KEYCODE_BACK)) {
if (getFragmentManager() != null) {
getFragmentManager().popBackStack();
}
}
return false;
}
}
);
return dialog;
}