Program: 92741
Project: 92741
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  CalligraphyConfig.initDefault("String_Node_Str",R.attr.neokree_fontPath);
  Resources.Theme theme=this.getTheme();
  TypedValue typedValue=new TypedValue();
  theme.resolveAttribute(R.attr.drawerType,typedValue,true);
  drawerHeaderType=typedValue.data;
  theme.resolveAttribute(R.attr.rippleBackport,typedValue,false);
  rippleSupport=typedValue.data != 0;
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS)   setContentView(R.layout.activity_material_navigation_drawer);
 else   setContentView(R.layout.activity_material_navigation_drawer_customheader);
  statusBar=(ImageView)findViewById(R.id.statusBar);
  toolbar=(Toolbar)findViewById(R.id.toolbar);
  layout=(MaterialDrawerLayout)this.findViewById(R.id.drawer_layout);
  content=(RelativeLayout)this.findViewById(R.id.content);
  drawer=(RelativeLayout)this.findViewById(R.id.drawer);
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
    username=(TextView)this.findViewById(R.id.user_nome);
    usermail=(TextView)this.findViewById(R.id.user_email);
    userphoto=(ImageView)this.findViewById(R.id.user_photo);
    userSecondPhoto=(ImageView)this.findViewById(R.id.user_photo_2);
    userThirdPhoto=(ImageView)this.findViewById(R.id.user_photo_3);
    usercover=(ImageView)this.findViewById(R.id.user_cover);
    usercoverSwitcher=(ImageView)this.findViewById(R.id.user_cover_switcher);
  }
 else   customDrawerHeader=(LinearLayout)this.findViewById(R.id.drawer_header);
  sections=(LinearLayout)this.findViewById(R.id.sections);
  bottomSections=(LinearLayout)this.findViewById(R.id.bottom_sections);
  sectionList=new LinkedList<>();
  bottomSectionList=new LinkedList<>();
  accountManager=new LinkedList<>();
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
    userphoto.setOnClickListener(currentAccountListener);
    usercover.setOnClickListener(currentAccountListener);
    userSecondPhoto.setOnClickListener(secondAccountListener);
    userThirdPhoto.setOnClickListener(thirdAccountListener);
  }
  resources=this.getResources();
  density=resources.getDisplayMetrics().density;
  theme.resolveAttribute(R.attr.colorPrimary,typedValue,true);
  primaryColor=typedValue.data;
  theme.resolveAttribute(R.attr.colorPrimaryDark,typedValue,true);
  primaryDarkColor=typedValue.data;
  if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
    TypedArray windowTraslucentAttribute=theme.obtainStyledAttributes(new int[]{android.R.attr.windowTranslucentStatus});
    kitkatTraslucentStatusbar=windowTraslucentAttribute.getBoolean(0,false);
    if (kitkatTraslucentStatusbar) {
      Window window=this.getWindow();
      window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      RelativeLayout.LayoutParams statusParams=new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,resources.getDimensionPixelSize(R.dimen.traslucentStatusMargin));
      statusBar.setLayoutParams(statusParams);
      statusBar.setImageDrawable(new ColorDrawable(darkenColor(primaryColor)));
      if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
        RelativeLayout.LayoutParams photoParams=(RelativeLayout.LayoutParams)userphoto.getLayoutParams();
        photoParams.setMargins((int)(16 * density),resources.getDimensionPixelSize(R.dimen.traslucentPhotoMarginTop),0,0);
        userphoto.setLayoutParams(photoParams);
      }
    }
  }
  this.setSupportActionBar(toolbar);
  actionBar=getSupportActionBar();
  init(savedInstanceState);
  if (sectionList.size() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  Configuration configuration=resources.getConfiguration();
  if (deviceSupportMultiPane()) {
    layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN,drawer);
    DrawerLayout.LayoutParams params=new DrawerLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    params.setMargins((int)(320 * density),0,0,0);
    content.setLayoutParams(params);
    layout.setScrimColor(Color.TRANSPARENT);
    layout.openDrawer(drawer);
    layout.requestDisallowInterceptTouchEvent(true);
  }
 else {
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    pulsante=new ActionBarDrawerToggle(this,layout,toolbar,R.string.nothing,R.string.nothing){
      public void onDrawerClosed(      View view){
        invalidateOptionsMenu();
        drawerTouchLocked=false;
        setSectionsTouch(!drawerTouchLocked);
        if (drawerListener != null)         drawerListener.onDrawerClosed(view);
      }
      public void onDrawerOpened(      View drawerView){
        invalidateOptionsMenu();
        if (drawerListener != null)         drawerListener.onDrawerOpened(drawerView);
      }
      @Override public void onDrawerSlide(      View drawerView,      float slideOffset){
        if (slidingDrawerEffect)         super.onDrawerSlide(drawerView,slideOffset);
 else         super.onDrawerSlide(drawerView,0);
        if (drawerListener != null)         drawerListener.onDrawerSlide(drawerView,slideOffset);
      }
      @Override public void onDrawerStateChanged(      int newState){
        super.onDrawerStateChanged(newState);
        if (drawerListener != null)         drawerListener.onDrawerStateChanged(newState);
      }
    }
;
    layout.setDrawerListener(pulsante);
  }
  ViewTreeObserver vto;
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS)   vto=usercover.getViewTreeObserver();
 else   vto=customDrawerHeader.getViewTreeObserver();
  vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      int width=drawer.getWidth();
      int heightCover;
switch (drawerHeaderType) {
default :
case DRAWERHEADER_ACCOUNTS:
case DRAWERHEADER_IMAGE:
case DRAWERHEADER_CUSTOM:
        heightCover=(9 * width) / 16;
      break;
case DRAWERHEADER_NO_HEADER:
    heightCover=(int)(25 * density);
  break;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT && !kitkatTraslucentStatusbar)) {
heightCover-=(density * 25);
}
if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
usercover.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,heightCover));
usercoverSwitcher.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,heightCover));
}
 else {
customDrawerHeader.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,heightCover));
}
int heightDrawer=(int)(((8 + 8 + 1) * density) + heightCover + sections.getHeight()+ ((density * 48) * bottomSectionList.size()));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT && !kitkatTraslucentStatusbar)) {
heightDrawer+=(density * 25);
}
if (heightDrawer >= getHeight()) {
addDivisor();
for (MaterialSection section : bottomSectionList) {
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int)(48 * density));
  sections.addView(section.getView(),params);
}
}
 else for (MaterialSection section : bottomSectionList) {
LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int)(48 * density));
bottomSections.addView(section.getView(),params);
}
ViewTreeObserver obs;
if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) obs=usercover.getViewTreeObserver();
 else obs=customDrawerHeader.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
}
 else {
obs.removeGlobalOnLayoutListener(this);
}
}
}
);
MaterialSection section;
if (savedInstanceState == null) {
if (accountManager.size() > 0) {
currentAccount=accountManager.get(0);
notifyAccountDataChanged();
}
section=sectionList.get(0);
}
 else {
ArrayList<Integer> accountNumbers=savedInstanceState.getIntegerArrayList(STATE_ACCOUNT);
for (int i=0; i < accountNumbers.size(); i++) {
MaterialAccount account=accountManager.get(i);
account.setAccountNumber(accountNumbers.get(i));
if (account.getAccountNumber() == MaterialAccount.FIRST_ACCOUNT) currentAccount=account;
}
notifyAccountDataChanged();
int accountSelected=savedInstanceState.getInt(STATE_SECTION);
if (accountSelected >= BOTTOM_SECTION_START) {
section=bottomSectionList.get(accountSelected - BOTTOM_SECTION_START);
}
 else section=sectionList.get(accountSelected);
if (section.getTarget() != MaterialSection.TARGET_FRAGMENT) {
section=sectionList.get(0);
}
changeToolbarColor(section);
}
title=section.getTitle();
currentSection=section;
section.select();
setFragment((Fragment)section.getTargetFragment(),section.getTitle(),null);
if (learningPattern) {
layout.openDrawer(drawer);
disableLearningPattern();
}
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  CalligraphyConfig.initDefault("String_Node_Str",R.attr.fontPath);
  Resources.Theme theme=this.getTheme();
  TypedValue typedValue=new TypedValue();
  theme.resolveAttribute(R.attr.drawerType,typedValue,true);
  drawerHeaderType=typedValue.data;
  theme.resolveAttribute(R.attr.rippleBackport,typedValue,false);
  rippleSupport=typedValue.data != 0;
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS)   setContentView(R.layout.activity_material_navigation_drawer);
 else   setContentView(R.layout.activity_material_navigation_drawer_customheader);
  statusBar=(ImageView)findViewById(R.id.statusBar);
  toolbar=(Toolbar)findViewById(R.id.toolbar);
  layout=(MaterialDrawerLayout)this.findViewById(R.id.drawer_layout);
  content=(RelativeLayout)this.findViewById(R.id.content);
  drawer=(RelativeLayout)this.findViewById(R.id.drawer);
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
    username=(TextView)this.findViewById(R.id.user_nome);
    usermail=(TextView)this.findViewById(R.id.user_email);
    userphoto=(ImageView)this.findViewById(R.id.user_photo);
    userSecondPhoto=(ImageView)this.findViewById(R.id.user_photo_2);
    userThirdPhoto=(ImageView)this.findViewById(R.id.user_photo_3);
    usercover=(ImageView)this.findViewById(R.id.user_cover);
    usercoverSwitcher=(ImageView)this.findViewById(R.id.user_cover_switcher);
  }
 else   customDrawerHeader=(LinearLayout)this.findViewById(R.id.drawer_header);
  sections=(LinearLayout)this.findViewById(R.id.sections);
  bottomSections=(LinearLayout)this.findViewById(R.id.bottom_sections);
  sectionList=new LinkedList<>();
  bottomSectionList=new LinkedList<>();
  accountManager=new LinkedList<>();
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
    userphoto.setOnClickListener(currentAccountListener);
    usercover.setOnClickListener(currentAccountListener);
    userSecondPhoto.setOnClickListener(secondAccountListener);
    userThirdPhoto.setOnClickListener(thirdAccountListener);
  }
  resources=this.getResources();
  density=resources.getDisplayMetrics().density;
  theme.resolveAttribute(R.attr.colorPrimary,typedValue,true);
  primaryColor=typedValue.data;
  theme.resolveAttribute(R.attr.colorPrimaryDark,typedValue,true);
  primaryDarkColor=typedValue.data;
  if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
    TypedArray windowTraslucentAttribute=theme.obtainStyledAttributes(new int[]{android.R.attr.windowTranslucentStatus});
    kitkatTraslucentStatusbar=windowTraslucentAttribute.getBoolean(0,false);
    if (kitkatTraslucentStatusbar) {
      Window window=this.getWindow();
      window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      RelativeLayout.LayoutParams statusParams=new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,resources.getDimensionPixelSize(R.dimen.traslucentStatusMargin));
      statusBar.setLayoutParams(statusParams);
      statusBar.setImageDrawable(new ColorDrawable(darkenColor(primaryColor)));
      if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
        RelativeLayout.LayoutParams photoParams=(RelativeLayout.LayoutParams)userphoto.getLayoutParams();
        photoParams.setMargins((int)(16 * density),resources.getDimensionPixelSize(R.dimen.traslucentPhotoMarginTop),0,0);
        userphoto.setLayoutParams(photoParams);
      }
    }
  }
  this.setSupportActionBar(toolbar);
  actionBar=getSupportActionBar();
  init(savedInstanceState);
  if (sectionList.size() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  Configuration configuration=resources.getConfiguration();
  if (deviceSupportMultiPane()) {
    layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN,drawer);
    DrawerLayout.LayoutParams params=new DrawerLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    params.setMargins((int)(320 * density),0,0,0);
    content.setLayoutParams(params);
    layout.setScrimColor(Color.TRANSPARENT);
    layout.openDrawer(drawer);
    layout.requestDisallowInterceptTouchEvent(true);
  }
 else {
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    pulsante=new ActionBarDrawerToggle(this,layout,toolbar,R.string.nothing,R.string.nothing){
      public void onDrawerClosed(      View view){
        invalidateOptionsMenu();
        drawerTouchLocked=false;
        setSectionsTouch(!drawerTouchLocked);
        if (drawerListener != null)         drawerListener.onDrawerClosed(view);
      }
      public void onDrawerOpened(      View drawerView){
        invalidateOptionsMenu();
        if (drawerListener != null)         drawerListener.onDrawerOpened(drawerView);
      }
      @Override public void onDrawerSlide(      View drawerView,      float slideOffset){
        if (slidingDrawerEffect)         super.onDrawerSlide(drawerView,slideOffset);
 else         super.onDrawerSlide(drawerView,0);
        if (drawerListener != null)         drawerListener.onDrawerSlide(drawerView,slideOffset);
      }
      @Override public void onDrawerStateChanged(      int newState){
        super.onDrawerStateChanged(newState);
        if (drawerListener != null)         drawerListener.onDrawerStateChanged(newState);
      }
    }
;
    layout.setDrawerListener(pulsante);
  }
  ViewTreeObserver vto;
  if (drawerHeaderType == DRAWERHEADER_ACCOUNTS)   vto=usercover.getViewTreeObserver();
 else   vto=customDrawerHeader.getViewTreeObserver();
  vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      int width=drawer.getWidth();
      int heightCover;
switch (drawerHeaderType) {
default :
case DRAWERHEADER_ACCOUNTS:
case DRAWERHEADER_IMAGE:
case DRAWERHEADER_CUSTOM:
        heightCover=(9 * width) / 16;
      break;
case DRAWERHEADER_NO_HEADER:
    heightCover=(int)(25 * density);
  break;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT && !kitkatTraslucentStatusbar)) {
heightCover-=(density * 25);
}
if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) {
usercover.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,heightCover));
usercoverSwitcher.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,heightCover));
}
 else {
customDrawerHeader.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,heightCover));
}
int heightDrawer=(int)(((8 + 8 + 1) * density) + heightCover + sections.getHeight()+ ((density * 48) * bottomSectionList.size()));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT && !kitkatTraslucentStatusbar)) {
heightDrawer+=(density * 25);
}
if (heightDrawer >= getHeight()) {
addDivisor();
for (MaterialSection section : bottomSectionList) {
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int)(48 * density));
  sections.addView(section.getView(),params);
}
}
 else for (MaterialSection section : bottomSectionList) {
LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int)(48 * density));
bottomSections.addView(section.getView(),params);
}
ViewTreeObserver obs;
if (drawerHeaderType == DRAWERHEADER_ACCOUNTS) obs=usercover.getViewTreeObserver();
 else obs=customDrawerHeader.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
}
 else {
obs.removeGlobalOnLayoutListener(this);
}
}
}
);
MaterialSection section;
if (savedInstanceState == null) {
if (accountManager.size() > 0) {
currentAccount=accountManager.get(0);
notifyAccountDataChanged();
}
section=sectionList.get(0);
}
 else {
ArrayList<Integer> accountNumbers=savedInstanceState.getIntegerArrayList(STATE_ACCOUNT);
for (int i=0; i < accountNumbers.size(); i++) {
MaterialAccount account=accountManager.get(i);
account.setAccountNumber(accountNumbers.get(i));
if (account.getAccountNumber() == MaterialAccount.FIRST_ACCOUNT) currentAccount=account;
}
notifyAccountDataChanged();
int accountSelected=savedInstanceState.getInt(STATE_SECTION);
if (accountSelected >= BOTTOM_SECTION_START) {
section=bottomSectionList.get(accountSelected - BOTTOM_SECTION_START);
}
 else section=sectionList.get(accountSelected);
if (section.getTarget() != MaterialSection.TARGET_FRAGMENT) {
section=sectionList.get(0);
}
changeToolbarColor(section);
}
title=section.getTitle();
currentSection=section;
section.select();
setFragment((Fragment)section.getTargetFragment(),section.getTitle(),null);
if (learningPattern) {
layout.openDrawer(drawer);
disableLearningPattern();
}
}