Program: 92518
Project: 92518
Buggy source:
@SuppressLint("String_Node_Str") protected MaterialDialog(Builder builder){
  super(getTheme(builder));
  mBuilder=builder;
  if (!mBuilder.useCustomFonts) {
    if (mBuilder.mediumFont == null)     mBuilder.mediumFont=TypefaceHelper.get(getContext(),"String_Node_Str");
    if (mBuilder.regularFont == null)     mBuilder.regularFont=TypefaceHelper.get(getContext(),"String_Node_Str");
  }
  this.view=LayoutInflater.from(getContext()).inflate(R.layout.md_dialog,null);
  this.setCancelable(builder.cancelable);
  if (mBuilder.backgroundColor == 0)   mBuilder.backgroundColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_background_color);
  if (mBuilder.backgroundColor != 0)   this.view.setBackgroundColor(mBuilder.backgroundColor);
  mBuilder.positiveColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_positive_color,mBuilder.positiveColor);
  mBuilder.neutralColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_negative_color,mBuilder.neutralColor);
  mBuilder.negativeColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_neutral_color,mBuilder.negativeColor);
  title=(TextView)view.findViewById(R.id.title);
  icon=(ImageView)view.findViewById(R.id.icon);
  titleFrame=view.findViewById(R.id.titleFrame);
  final TextView content=(TextView)view.findViewById(R.id.content);
  content.setText(builder.content);
  content.setMovementMethod(new LinkMovementMethod());
  setTypeface(content,mBuilder.regularFont);
  content.setLineSpacing(0f,builder.contentLineSpacingMultiplier);
  if (mBuilder.positiveColor == 0) {
    content.setLinkTextColor(DialogUtils.resolveColor(getContext(),android.R.attr.textColorPrimary));
  }
 else {
    content.setLinkTextColor(mBuilder.positiveColor);
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    title.setTextAlignment(gravityToAlignment(builder.titleGravity));
  }
 else {
    title.setGravity(gravityIntToGravity(builder.titleGravity));
  }
  if (builder.contentColor != -1) {
    content.setTextColor(builder.contentColor);
  }
 else {
    final int fallback=DialogUtils.resolveColor(getContext(),android.R.attr.textColorSecondary);
    final int contentColor=DialogUtils.resolveColor(getContext(),R.attr.md_content_color,fallback);
    content.setTextColor(contentColor);
  }
  if (builder.itemColor != 0) {
    defaultItemColor=builder.itemColor;
  }
 else   if (builder.theme == Theme.LIGHT) {
    defaultItemColor=Color.BLACK;
  }
 else {
    defaultItemColor=Color.WHITE;
  }
  if (mBuilder.customView != null) {
    invalidateCustomViewAssociations();
    FrameLayout frame=(FrameLayout)view.findViewById(R.id.customViewFrame);
    customViewFrame=frame;
    View innerView=mBuilder.customView;
    if (mBuilder.wrapCustomViewInScroll) {
      final Resources r=getContext().getResources();
      final int frameMargin=r.getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
      final ScrollView sv=new ScrollView(getContext());
      int paddingTop;
      int paddingBottom;
      if (titleFrame.getVisibility() != View.GONE)       paddingTop=r.getDimensionPixelSize(R.dimen.md_content_vertical_padding);
 else       paddingTop=r.getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
      if (hasActionButtons())       paddingBottom=r.getDimensionPixelSize(R.dimen.md_content_vertical_padding);
 else       paddingBottom=r.getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
      sv.setPadding(0,paddingTop,0,paddingBottom);
      sv.setClipToPadding(false);
      ScrollView.LayoutParams innerViewLayoutParams=new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
      innerViewLayoutParams.setMargins(frameMargin,0,frameMargin,0);
      sv.addView(innerView,innerViewLayoutParams);
      innerView=sv;
    }
    frame.addView(innerView,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  }
 else {
    invalidateCustomViewAssociations();
  }
  boolean adapterProvided=mBuilder.adapter != null;
  if (mBuilder.items != null && mBuilder.items.length > 0 || adapterProvided) {
    listView=(ListView)view.findViewById(R.id.contentListView);
    listView.setSelector(getListSelector());
    if (!adapterProvided) {
      if (mBuilder.listCallbackSingle != null) {
        listType=ListType.SINGLE;
      }
 else       if (mBuilder.listCallbackMulti != null) {
        listType=ListType.MULTI;
        if (mBuilder.selectedIndices != null) {
          selectedIndicesList=new ArrayList<>(Arrays.asList(mBuilder.selectedIndices));
        }
 else {
          selectedIndicesList=new ArrayList<>();
        }
      }
 else {
        listType=ListType.REGULAR;
      }
      mBuilder.adapter=new MaterialDialogAdapter(mBuilder.context,ListType.getLayoutForType(listType),R.id.title,mBuilder.items);
    }
  }
  if (builder.icon != null) {
    icon.setVisibility(View.VISIBLE);
    icon.setImageDrawable(builder.icon);
  }
 else {
    Drawable d=DialogUtils.resolveDrawable(mBuilder.context,R.attr.md_icon);
    if (d != null) {
      icon.setVisibility(View.VISIBLE);
      icon.setImageDrawable(d);
    }
 else {
      icon.setVisibility(View.GONE);
    }
  }
  if (builder.title == null || builder.title.toString().trim().length() == 0) {
    titleFrame.setVisibility(View.GONE);
  }
 else {
    title.setText(builder.title);
    setTypeface(title,mBuilder.mediumFont);
    if (builder.titleColor != -1) {
      title.setTextColor(builder.titleColor);
    }
 else {
      final int fallback=DialogUtils.resolveColor(getContext(),android.R.attr.textColorPrimary);
      title.setTextColor(DialogUtils.resolveColor(getContext(),R.attr.md_title_color,fallback));
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      content.setTextAlignment(gravityToAlignment(builder.contentGravity));
    }
 else {
      content.setGravity(gravityIntToGravity(builder.contentGravity));
    }
  }
  if (builder.showListener != null) {
    setOnShowListener(builder.showListener);
  }
  if (builder.cancelListener != null) {
    setOnCancelListener(builder.cancelListener);
  }
  if (builder.dismissListener != null) {
    setOnDismissListener(builder.dismissListener);
  }
  if (builder.keyListener != null) {
    setOnKeyListener(builder.keyListener);
  }
  updateFramePadding();
  invalidateActions();
  setOnShowListenerInternal();
  setViewInternal(view);
  view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      if (view.getMeasuredWidth() > 0) {
        invalidateCustomViewAssociations();
      }
    }
  }
);
  if (builder.theme == Theme.LIGHT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
    setInverseBackgroundForced(true);
    if (builder.titleColor == -1)     title.setTextColor(Color.BLACK);
    if (builder.contentColor == -1)     content.setTextColor(Color.BLACK);
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") protected MaterialDialog(Builder builder){
  super(getTheme(builder));
  mBuilder=builder;
  if (!mBuilder.useCustomFonts) {
    if (mBuilder.mediumFont == null)     mBuilder.mediumFont=TypefaceHelper.get(getContext(),"String_Node_Str");
    if (mBuilder.regularFont == null)     mBuilder.regularFont=TypefaceHelper.get(getContext(),"String_Node_Str");
  }
  this.view=LayoutInflater.from(getContext()).inflate(R.layout.md_dialog,null);
  this.setCancelable(builder.cancelable);
  if (mBuilder.backgroundColor == 0)   mBuilder.backgroundColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_background_color);
  if (mBuilder.backgroundColor != 0)   this.view.setBackgroundColor(mBuilder.backgroundColor);
  mBuilder.positiveColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_positive_color,mBuilder.positiveColor);
  mBuilder.neutralColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_negative_color,mBuilder.neutralColor);
  mBuilder.negativeColor=DialogUtils.resolveColor(mBuilder.context,R.attr.md_neutral_color,mBuilder.negativeColor);
  title=(TextView)view.findViewById(R.id.title);
  icon=(ImageView)view.findViewById(R.id.icon);
  titleFrame=view.findViewById(R.id.titleFrame);
  final TextView content=(TextView)view.findViewById(R.id.content);
  content.setText(builder.content);
  content.setMovementMethod(new LinkMovementMethod());
  setTypeface(content,mBuilder.regularFont);
  content.setLineSpacing(0f,builder.contentLineSpacingMultiplier);
  if (mBuilder.positiveColor == 0) {
    content.setLinkTextColor(DialogUtils.resolveColor(getContext(),android.R.attr.textColorPrimary));
  }
 else {
    content.setLinkTextColor(mBuilder.positiveColor);
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    title.setTextAlignment(gravityToAlignment(builder.titleGravity));
  }
 else {
    title.setGravity(gravityIntToGravity(builder.titleGravity));
  }
  if (builder.contentColorSet) {
    content.setTextColor(builder.contentColor);
  }
 else {
    final int fallback=DialogUtils.resolveColor(getContext(),android.R.attr.textColorSecondary);
    final int contentColor=DialogUtils.resolveColor(getContext(),R.attr.md_content_color,fallback);
    content.setTextColor(contentColor);
  }
  if (builder.itemColorSet) {
    defaultItemColor=builder.itemColor;
  }
 else   if (builder.theme == Theme.LIGHT) {
    defaultItemColor=Color.BLACK;
  }
 else {
    defaultItemColor=Color.WHITE;
  }
  if (mBuilder.customView != null) {
    invalidateCustomViewAssociations();
    FrameLayout frame=(FrameLayout)view.findViewById(R.id.customViewFrame);
    customViewFrame=frame;
    View innerView=mBuilder.customView;
    if (mBuilder.wrapCustomViewInScroll) {
      final Resources r=getContext().getResources();
      final int frameMargin=r.getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
      final ScrollView sv=new ScrollView(getContext());
      int paddingTop;
      int paddingBottom;
      if (titleFrame.getVisibility() != View.GONE)       paddingTop=r.getDimensionPixelSize(R.dimen.md_content_vertical_padding);
 else       paddingTop=r.getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
      if (hasActionButtons())       paddingBottom=r.getDimensionPixelSize(R.dimen.md_content_vertical_padding);
 else       paddingBottom=r.getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
      sv.setPadding(0,paddingTop,0,paddingBottom);
      sv.setClipToPadding(false);
      ScrollView.LayoutParams innerViewLayoutParams=new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
      innerViewLayoutParams.setMargins(frameMargin,0,frameMargin,0);
      sv.addView(innerView,innerViewLayoutParams);
      innerView=sv;
    }
    frame.addView(innerView,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  }
 else {
    invalidateCustomViewAssociations();
  }
  boolean adapterProvided=mBuilder.adapter != null;
  if (mBuilder.items != null && mBuilder.items.length > 0 || adapterProvided) {
    listView=(ListView)view.findViewById(R.id.contentListView);
    listView.setSelector(getListSelector());
    if (!adapterProvided) {
      if (mBuilder.listCallbackSingle != null) {
        listType=ListType.SINGLE;
      }
 else       if (mBuilder.listCallbackMulti != null) {
        listType=ListType.MULTI;
        if (mBuilder.selectedIndices != null) {
          selectedIndicesList=new ArrayList<>(Arrays.asList(mBuilder.selectedIndices));
        }
 else {
          selectedIndicesList=new ArrayList<>();
        }
      }
 else {
        listType=ListType.REGULAR;
      }
      mBuilder.adapter=new MaterialDialogAdapter(mBuilder.context,ListType.getLayoutForType(listType),R.id.title,mBuilder.items);
    }
  }
  if (builder.icon != null) {
    icon.setVisibility(View.VISIBLE);
    icon.setImageDrawable(builder.icon);
  }
 else {
    Drawable d=DialogUtils.resolveDrawable(mBuilder.context,R.attr.md_icon);
    if (d != null) {
      icon.setVisibility(View.VISIBLE);
      icon.setImageDrawable(d);
    }
 else {
      icon.setVisibility(View.GONE);
    }
  }
  if (builder.title == null || builder.title.toString().trim().length() == 0) {
    titleFrame.setVisibility(View.GONE);
  }
 else {
    title.setText(builder.title);
    setTypeface(title,mBuilder.mediumFont);
    if (builder.titleColor != -1) {
      title.setTextColor(builder.titleColor);
    }
 else {
      final int fallback=DialogUtils.resolveColor(getContext(),android.R.attr.textColorPrimary);
      title.setTextColor(DialogUtils.resolveColor(getContext(),R.attr.md_title_color,fallback));
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      content.setTextAlignment(gravityToAlignment(builder.contentGravity));
    }
 else {
      content.setGravity(gravityIntToGravity(builder.contentGravity));
    }
  }
  if (builder.showListener != null) {
    setOnShowListener(builder.showListener);
  }
  if (builder.cancelListener != null) {
    setOnCancelListener(builder.cancelListener);
  }
  if (builder.dismissListener != null) {
    setOnDismissListener(builder.dismissListener);
  }
  if (builder.keyListener != null) {
    setOnKeyListener(builder.keyListener);
  }
  updateFramePadding();
  invalidateActions();
  setOnShowListenerInternal();
  setViewInternal(view);
  view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      if (view.getMeasuredWidth() > 0) {
        invalidateCustomViewAssociations();
      }
    }
  }
);
  if (builder.theme == Theme.LIGHT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
    setInverseBackgroundForced(true);
    if (builder.titleColor == -1)     title.setTextColor(Color.BLACK);
    if (builder.contentColor == -1)     content.setTextColor(Color.BLACK);
  }
}