Program: 92497
Project: 92497
Buggy source:
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState){
  if (getArguments() == null || !getArguments().containsKey("String_Node_Str"))   throw new IllegalStateException("String_Node_Str");
  generateColors();
  int preselectColor;
  boolean foundPreselectColor=false;
  if (savedInstanceState != null) {
    foundPreselectColor=!savedInstanceState.getBoolean("String_Node_Str",false);
    preselectColor=getSelectedColor();
  }
 else {
    if (getBuilder().mSetPreselectionColor) {
      preselectColor=getBuilder().mPreselect;
      if (preselectColor != 0) {
        for (int topIndex=0; topIndex < mColorsTop.length; topIndex++) {
          if (mColorsTop[topIndex] == preselectColor) {
            foundPreselectColor=true;
            topIndex(topIndex);
            if (getBuilder().mAccentMode) {
              subIndex(2);
            }
 else             if (mColorsSub != null) {
              findSubIndexForColor(topIndex,preselectColor);
            }
 else {
              subIndex(5);
            }
            break;
          }
          if (mColorsSub != null) {
            for (int subIndex=0; subIndex < mColorsSub[topIndex].length; subIndex++) {
              if (mColorsSub[topIndex][subIndex] == preselectColor) {
                foundPreselectColor=true;
                topIndex(topIndex);
                subIndex(subIndex);
                break;
              }
            }
            if (foundPreselectColor)             break;
          }
        }
      }
    }
 else {
      preselectColor=Color.BLACK;
      foundPreselectColor=true;
    }
  }
  mCircleSize=getResources().getDimensionPixelSize(R.dimen.md_colorchooser_circlesize);
  final Builder builder=getBuilder();
  MaterialDialog.Builder bd=new MaterialDialog.Builder(getActivity()).title(getTitle()).autoDismiss(false).customView(R.layout.md_dialog_colorchooser,false).negativeText(builder.mCancelBtn).positiveText(builder.mDoneBtn).neutralText(builder.mAllowUserCustom ? builder.mCustomBtn : 0).onPositive(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      mCallback.onColorSelection(ColorChooserDialog.this,getSelectedColor());
      dismiss();
    }
  }
).onNegative(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      if (isInSub()) {
        dialog.setActionButton(DialogAction.NEGATIVE,getBuilder().mCancelBtn);
        isInSub(false);
        invalidate();
      }
 else {
        dialog.cancel();
      }
    }
  }
).onNeutral(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      toggleCustom(dialog);
    }
  }
).showListener(new DialogInterface.OnShowListener(){
    @Override public void onShow(    DialogInterface dialog){
      invalidateDynamicButtonColors();
    }
  }
);
  if (builder.mTheme != null)   bd.theme(builder.mTheme);
  final MaterialDialog dialog=bd.build();
  final View v=dialog.getCustomView();
  mGrid=(GridView)v.findViewById(R.id.md_grid);
  if (builder.mAllowUserCustom) {
    mSelectedCustomColor=preselectColor;
    mColorChooserCustomFrame=v.findViewById(R.id.md_colorChooserCustomFrame);
    mCustomColorHex=(EditText)v.findViewById(R.id.md_hexInput);
    mCustomColorIndicator=v.findViewById(R.id.md_colorIndicator);
    mCustomSeekA=(SeekBar)v.findViewById(R.id.md_colorA);
    mCustomSeekAValue=(TextView)v.findViewById(R.id.md_colorAValue);
    mCustomSeekR=(SeekBar)v.findViewById(R.id.md_colorR);
    mCustomSeekRValue=(TextView)v.findViewById(R.id.md_colorRValue);
    mCustomSeekG=(SeekBar)v.findViewById(R.id.md_colorG);
    mCustomSeekGValue=(TextView)v.findViewById(R.id.md_colorGValue);
    mCustomSeekB=(SeekBar)v.findViewById(R.id.md_colorB);
    mCustomSeekBValue=(TextView)v.findViewById(R.id.md_colorBValue);
    if (!builder.mAllowUserCustomAlpha) {
      v.findViewById(R.id.md_colorALabel).setVisibility(View.GONE);
      mCustomSeekA.setVisibility(View.GONE);
      mCustomSeekAValue.setVisibility(View.GONE);
      mCustomColorHex.setHint("String_Node_Str");
      mCustomColorHex.setFilters(new InputFilter[]{new InputFilter.LengthFilter(6)});
    }
 else {
      mCustomColorHex.setHint("String_Node_Str");
      mCustomColorHex.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8)});
    }
    if (!foundPreselectColor) {
      toggleCustom(dialog);
    }
  }
  invalidate();
  return dialog;
}

Fixed version (ground truth):
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState){
  if (getArguments() == null || !getArguments().containsKey("String_Node_Str"))   throw new IllegalStateException("String_Node_Str");
  generateColors();
  int preselectColor;
  boolean foundPreselectColor=false;
  if (savedInstanceState != null) {
    foundPreselectColor=!savedInstanceState.getBoolean("String_Node_Str",false);
    preselectColor=getSelectedColor();
  }
 else {
    if (getBuilder().mSetPreselectionColor) {
      preselectColor=getBuilder().mPreselect;
      if (preselectColor != 0) {
        for (int topIndex=0; topIndex < mColorsTop.length; topIndex++) {
          if (mColorsTop[topIndex] == preselectColor) {
            foundPreselectColor=true;
            topIndex(topIndex);
            if (getBuilder().mAccentMode) {
              subIndex(2);
            }
 else             if (mColorsSub != null) {
              findSubIndexForColor(topIndex,preselectColor);
            }
 else {
              subIndex(5);
            }
            break;
          }
          if (mColorsSub != null) {
            for (int subIndex=0; subIndex < mColorsSub[topIndex].length; subIndex++) {
              if (mColorsSub[topIndex][subIndex] == preselectColor) {
                foundPreselectColor=true;
                topIndex(topIndex);
                subIndex(subIndex);
                break;
              }
            }
            if (foundPreselectColor)             break;
          }
        }
      }
    }
 else {
      preselectColor=Color.BLACK;
      foundPreselectColor=true;
    }
  }
  mCircleSize=getResources().getDimensionPixelSize(R.dimen.md_colorchooser_circlesize);
  final Builder builder=getBuilder();
  MaterialDialog.Builder bd=new MaterialDialog.Builder(getActivity()).title(getTitle()).autoDismiss(false).customView(R.layout.md_dialog_colorchooser,false).negativeText(builder.mCancelBtn).positiveText(builder.mDoneBtn).neutralText(builder.mAllowUserCustom ? builder.mCustomBtn : 0).onPositive(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      mCallback.onColorSelection(ColorChooserDialog.this,getSelectedColor());
      dismiss();
    }
  }
).onNegative(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      if (isInSub()) {
        dialog.setActionButton(DialogAction.NEGATIVE,getBuilder().mCancelBtn);
        isInSub(false);
        subIndex(-1);
        invalidate();
      }
 else {
        dialog.cancel();
      }
    }
  }
).onNeutral(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      toggleCustom(dialog);
    }
  }
).showListener(new DialogInterface.OnShowListener(){
    @Override public void onShow(    DialogInterface dialog){
      invalidateDynamicButtonColors();
    }
  }
);
  if (builder.mTheme != null)   bd.theme(builder.mTheme);
  final MaterialDialog dialog=bd.build();
  final View v=dialog.getCustomView();
  mGrid=(GridView)v.findViewById(R.id.md_grid);
  if (builder.mAllowUserCustom) {
    mSelectedCustomColor=preselectColor;
    mColorChooserCustomFrame=v.findViewById(R.id.md_colorChooserCustomFrame);
    mCustomColorHex=(EditText)v.findViewById(R.id.md_hexInput);
    mCustomColorIndicator=v.findViewById(R.id.md_colorIndicator);
    mCustomSeekA=(SeekBar)v.findViewById(R.id.md_colorA);
    mCustomSeekAValue=(TextView)v.findViewById(R.id.md_colorAValue);
    mCustomSeekR=(SeekBar)v.findViewById(R.id.md_colorR);
    mCustomSeekRValue=(TextView)v.findViewById(R.id.md_colorRValue);
    mCustomSeekG=(SeekBar)v.findViewById(R.id.md_colorG);
    mCustomSeekGValue=(TextView)v.findViewById(R.id.md_colorGValue);
    mCustomSeekB=(SeekBar)v.findViewById(R.id.md_colorB);
    mCustomSeekBValue=(TextView)v.findViewById(R.id.md_colorBValue);
    if (!builder.mAllowUserCustomAlpha) {
      v.findViewById(R.id.md_colorALabel).setVisibility(View.GONE);
      mCustomSeekA.setVisibility(View.GONE);
      mCustomSeekAValue.setVisibility(View.GONE);
      mCustomColorHex.setHint("String_Node_Str");
      mCustomColorHex.setFilters(new InputFilter[]{new InputFilter.LengthFilter(6)});
    }
 else {
      mCustomColorHex.setHint("String_Node_Str");
      mCustomColorHex.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8)});
    }
    if (!foundPreselectColor) {
      toggleCustom(dialog);
    }
  }
  invalidate();
  return dialog;
}