Program: 95135
Project: 95135
Buggy source:
/** 
 * Account for the various ui elements and update the map padding so that it remains 'visible'.
 */
private void updateMapPadding(){
  final int slidingDrawerWidth=mSlidingDrawer.getContent().getWidth();
  final boolean isSlidingDrawerOpened=mSlidingDrawer.isOpened();
  int rightPadding=isSlidingDrawerOpened ? slidingDrawerWidth : 0;
  int bottomPadding=0;
  int leftPadding=0;
  int topPadding=mLocationButtonsContainer.getTop();
  if (warningView != null && warningView.getVisibility() != View.GONE) {
    topPadding+=warningView.getHeight();
  }
  final View editorToolsView=editorTools.getView();
  final View mapView=mapFragment.getView();
  int[] posOnScreen=new int[2];
  editorToolsView.getLocationOnScreen(posOnScreen);
  final int toolsHeight=editorToolsView.getHeight();
  final int toolsBottom=posOnScreen[1] + toolsHeight;
  ViewGroup.LayoutParams lp=editorToolsView.getLayoutParams();
  if (lp.height == ViewGroup.LayoutParams.MATCH_PARENT) {
    leftPadding=editorToolsView.getRight();
  }
 else {
    if (mTelemetryView != null) {
      leftPadding=mTelemetryView.getRight();
    }
    if (lp.width == ViewGroup.LayoutParams.MATCH_PARENT) {
      mapView.getLocationOnScreen(posOnScreen);
      final int mapTop=posOnScreen[1];
      final int mapBottom=mapTop + mapView.getHeight();
      bottomPadding=(mapBottom - toolsBottom) + toolsHeight;
    }
  }
  mapFragment.setMapPadding(leftPadding,topPadding,rightPadding,bottomPadding);
  final ViewGroup.MarginLayoutParams marginLp=(ViewGroup.MarginLayoutParams)mLocationButtonsContainer.getLayoutParams();
  final int rightMargin=isSlidingDrawerOpened ? marginLp.leftMargin + slidingDrawerWidth : marginLp.leftMargin;
  marginLp.setMargins(marginLp.leftMargin,marginLp.topMargin,rightMargin,marginLp.bottomMargin);
}

Fixed version (ground truth):
/** 
 * Account for the various ui elements and update the map padding so that it remains 'visible'.
 */
private void updateMapPadding(){
  if (mapFragment == null) {
    return;
  }
  final int slidingDrawerWidth=mSlidingDrawer.getContent().getWidth();
  final boolean isSlidingDrawerOpened=mSlidingDrawer.isOpened();
  int rightPadding=isSlidingDrawerOpened ? slidingDrawerWidth : 0;
  int bottomPadding=0;
  int leftPadding=0;
  int topPadding=mLocationButtonsContainer.getTop();
  if (warningView != null && warningView.getVisibility() != View.GONE) {
    topPadding+=warningView.getHeight();
  }
  final View editorToolsView=editorTools.getView();
  final View mapView=mapFragment.getView();
  int[] posOnScreen=new int[2];
  editorToolsView.getLocationOnScreen(posOnScreen);
  final int toolsHeight=editorToolsView.getHeight();
  final int toolsBottom=posOnScreen[1] + toolsHeight;
  ViewGroup.LayoutParams lp=editorToolsView.getLayoutParams();
  if (lp.height == ViewGroup.LayoutParams.MATCH_PARENT) {
    leftPadding=editorToolsView.getRight();
  }
 else {
    if (mTelemetryView != null) {
      leftPadding=mTelemetryView.getRight();
    }
    if (lp.width == ViewGroup.LayoutParams.MATCH_PARENT) {
      mapView.getLocationOnScreen(posOnScreen);
      final int mapTop=posOnScreen[1];
      final int mapBottom=mapTop + mapView.getHeight();
      bottomPadding=(mapBottom - toolsBottom) + toolsHeight;
    }
  }
  mapFragment.setMapPadding(leftPadding,topPadding,rightPadding,bottomPadding);
  final ViewGroup.MarginLayoutParams marginLp=(ViewGroup.MarginLayoutParams)mLocationButtonsContainer.getLayoutParams();
  final int rightMargin=isSlidingDrawerOpened ? marginLp.leftMargin + slidingDrawerWidth : marginLp.leftMargin;
  marginLp.setMargins(marginLp.leftMargin,marginLp.topMargin,rightMargin,marginLp.bottomMargin);
}