Program: 26267
Project: 26267
Buggy source:
protected void drawDataSet(Canvas c,IPieDataSet dataSet){
  float angle=0;
  float rotationAngle=mChart.getRotationAngle();
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  final RectF circleBox=mChart.getCircleBox();
  final int entryCount=dataSet.getEntryCount();
  final float[] drawAngles=mChart.getDrawAngles();
  final MPPointF center=mChart.getCenterCircleBox();
  final float radius=mChart.getRadius();
  final boolean drawInnerArc=mChart.isDrawHoleEnabled() && !mChart.isDrawSlicesUnderHoleEnabled();
  final float userInnerRadius=drawInnerArc ? radius * (mChart.getHoleRadius() / 100.f) : 0.f;
  int visibleAngleCount=0;
  for (int j=0; j < entryCount; j++) {
    if ((Math.abs(dataSet.getEntryForIndex(j).getY()) > Utils.FLOAT_EPSILON)) {
      visibleAngleCount++;
    }
  }
  final float sliceSpace=visibleAngleCount <= 1 ? 0.f : getSliceSpace(dataSet);
  for (int j=0; j < entryCount; j++) {
    float sliceAngle=drawAngles[j];
    float innerRadius=userInnerRadius;
    Entry e=dataSet.getEntryForIndex(j);
    if ((Math.abs(e.getY()) > Utils.FLOAT_EPSILON)) {
      if (!mChart.needsHighlight(j)) {
        final boolean accountForSliceSpacing=sliceSpace > 0.f && sliceAngle <= 180.f;
        mRenderPaint.setColor(dataSet.getColor(j));
        final float sliceSpaceAngleOuter=visibleAngleCount == 1 ? 0.f : sliceSpace / (Utils.FDEG2RAD * radius);
        final float startAngleOuter=rotationAngle + (angle + sliceSpaceAngleOuter / 2.f) * phaseY;
        float sweepAngleOuter=(sliceAngle - sliceSpaceAngleOuter) * phaseY;
        if (sweepAngleOuter < 0.f) {
          sweepAngleOuter=0.f;
        }
        mPathBuffer.reset();
        float arcStartPointX=0.f, arcStartPointY=0.f;
        if (sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) {
          mPathBuffer.addCircle(center.x,center.y,radius,Path.Direction.CW);
        }
 else {
          arcStartPointX=center.x + radius * (float)Math.cos(startAngleOuter * Utils.FDEG2RAD);
          arcStartPointY=center.y + radius * (float)Math.sin(startAngleOuter * Utils.FDEG2RAD);
          mPathBuffer.moveTo(arcStartPointX,arcStartPointY);
          mPathBuffer.arcTo(circleBox,startAngleOuter,sweepAngleOuter);
        }
        mInnerRectBuffer.set(center.x - innerRadius,center.y - innerRadius,center.x + innerRadius,center.y + innerRadius);
        if (drawInnerArc && (innerRadius > 0.f || accountForSliceSpacing)) {
          if (accountForSliceSpacing) {
            float minSpacedRadius=calculateMinimumRadiusForSpacedSlice(center,radius,sliceAngle * phaseY,arcStartPointX,arcStartPointY,startAngleOuter,sweepAngleOuter);
            if (minSpacedRadius < 0.f)             minSpacedRadius=-minSpacedRadius;
            innerRadius=Math.max(innerRadius,minSpacedRadius);
          }
          final float sliceSpaceAngleInner=visibleAngleCount == 1 || innerRadius == 0.f ? 0.f : sliceSpace / (Utils.FDEG2RAD * innerRadius);
          final float startAngleInner=rotationAngle + (angle + sliceSpaceAngleInner / 2.f) * phaseY;
          float sweepAngleInner=(sliceAngle - sliceSpaceAngleInner) * phaseY;
          if (sweepAngleInner < 0.f) {
            sweepAngleInner=0.f;
          }
          final float endAngleInner=startAngleInner + sweepAngleInner;
          if (sweepAngleOuter % 360f == 0.f) {
            mPathBuffer.addCircle(center.x,center.y,innerRadius,Path.Direction.CCW);
          }
 else {
            mPathBuffer.lineTo(center.x + innerRadius * (float)Math.cos(endAngleInner * Utils.FDEG2RAD),center.y + innerRadius * (float)Math.sin(endAngleInner * Utils.FDEG2RAD));
            mPathBuffer.arcTo(mInnerRectBuffer,endAngleInner,-sweepAngleInner);
          }
        }
 else {
          if (sweepAngleOuter % 360f != 0.f) {
            if (accountForSliceSpacing) {
              float angleMiddle=startAngleOuter + sweepAngleOuter / 2.f;
              float sliceSpaceOffset=calculateMinimumRadiusForSpacedSlice(center,radius,sliceAngle * phaseY,arcStartPointX,arcStartPointY,startAngleOuter,sweepAngleOuter);
              float arcEndPointX=center.x + sliceSpaceOffset * (float)Math.cos(angleMiddle * Utils.FDEG2RAD);
              float arcEndPointY=center.y + sliceSpaceOffset * (float)Math.sin(angleMiddle * Utils.FDEG2RAD);
              mPathBuffer.lineTo(arcEndPointX,arcEndPointY);
            }
 else {
              mPathBuffer.lineTo(center.x,center.y);
            }
          }
        }
        mPathBuffer.close();
        mBitmapCanvas.drawPath(mPathBuffer,mRenderPaint);
      }
    }
    angle+=sliceAngle * phaseX;
  }
  MPPointF.recycleInstance(center);
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,IPieDataSet dataSet){
  float angle=0;
  float rotationAngle=mChart.getRotationAngle();
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  final RectF circleBox=mChart.getCircleBox();
  final int entryCount=dataSet.getEntryCount();
  final float[] drawAngles=mChart.getDrawAngles();
  final MPPointF center=mChart.getCenterCircleBox();
  final float radius=mChart.getRadius();
  final boolean drawInnerArc=mChart.isDrawHoleEnabled() && !mChart.isDrawSlicesUnderHoleEnabled();
  final float userInnerRadius=drawInnerArc ? radius * (mChart.getHoleRadius() / 100.f) : 0.f;
  int visibleAngleCount=0;
  for (int j=0; j < entryCount; j++) {
    if ((Math.abs(dataSet.getEntryForIndex(j).getY()) > Utils.FLOAT_EPSILON)) {
      visibleAngleCount++;
    }
  }
  final float sliceSpace=visibleAngleCount <= 1 ? 0.f : getSliceSpace(dataSet);
  for (int j=0; j < entryCount; j++) {
    float sliceAngle=drawAngles[j];
    float innerRadius=userInnerRadius;
    Entry e=dataSet.getEntryForIndex(j);
    if ((Math.abs(e.getY()) > Utils.FLOAT_EPSILON)) {
      if (!mChart.needsHighlight(j)) {
        final boolean accountForSliceSpacing=sliceSpace > 0.f && sliceAngle <= 180.f;
        mRenderPaint.setColor(dataSet.getColor(j));
        final float sliceSpaceAngleOuter=visibleAngleCount == 1 ? 0.f : sliceSpace / (Utils.FDEG2RAD * radius);
        final float startAngleOuter=rotationAngle + (angle + sliceSpaceAngleOuter / 2.f) * phaseY;
        float sweepAngleOuter=(sliceAngle - sliceSpaceAngleOuter) * phaseY;
        if (sweepAngleOuter < 0.f) {
          sweepAngleOuter=0.f;
        }
        mPathBuffer.reset();
        float arcStartPointX=center.x + radius * (float)Math.cos(startAngleOuter * Utils.FDEG2RAD);
        float arcStartPointY=center.y + radius * (float)Math.sin(startAngleOuter * Utils.FDEG2RAD);
        if (sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) {
          mPathBuffer.addCircle(center.x,center.y,radius,Path.Direction.CW);
        }
 else {
          mPathBuffer.moveTo(arcStartPointX,arcStartPointY);
          mPathBuffer.arcTo(circleBox,startAngleOuter,sweepAngleOuter);
        }
        mInnerRectBuffer.set(center.x - innerRadius,center.y - innerRadius,center.x + innerRadius,center.y + innerRadius);
        if (drawInnerArc && (innerRadius > 0.f || accountForSliceSpacing)) {
          if (accountForSliceSpacing) {
            float minSpacedRadius=calculateMinimumRadiusForSpacedSlice(center,radius,sliceAngle * phaseY,arcStartPointX,arcStartPointY,startAngleOuter,sweepAngleOuter);
            if (minSpacedRadius < 0.f)             minSpacedRadius=-minSpacedRadius;
            innerRadius=Math.max(innerRadius,minSpacedRadius);
          }
          final float sliceSpaceAngleInner=visibleAngleCount == 1 || innerRadius == 0.f ? 0.f : sliceSpace / (Utils.FDEG2RAD * innerRadius);
          final float startAngleInner=rotationAngle + (angle + sliceSpaceAngleInner / 2.f) * phaseY;
          float sweepAngleInner=(sliceAngle - sliceSpaceAngleInner) * phaseY;
          if (sweepAngleInner < 0.f) {
            sweepAngleInner=0.f;
          }
          final float endAngleInner=startAngleInner + sweepAngleInner;
          if (sweepAngleOuter % 360f == 0.f) {
            mPathBuffer.addCircle(center.x,center.y,innerRadius,Path.Direction.CCW);
          }
 else {
            mPathBuffer.lineTo(center.x + innerRadius * (float)Math.cos(endAngleInner * Utils.FDEG2RAD),center.y + innerRadius * (float)Math.sin(endAngleInner * Utils.FDEG2RAD));
            mPathBuffer.arcTo(mInnerRectBuffer,endAngleInner,-sweepAngleInner);
          }
        }
 else {
          if (sweepAngleOuter % 360f != 0.f) {
            if (accountForSliceSpacing) {
              float angleMiddle=startAngleOuter + sweepAngleOuter / 2.f;
              float sliceSpaceOffset=calculateMinimumRadiusForSpacedSlice(center,radius,sliceAngle * phaseY,arcStartPointX,arcStartPointY,startAngleOuter,sweepAngleOuter);
              float arcEndPointX=center.x + sliceSpaceOffset * (float)Math.cos(angleMiddle * Utils.FDEG2RAD);
              float arcEndPointY=center.y + sliceSpaceOffset * (float)Math.sin(angleMiddle * Utils.FDEG2RAD);
              mPathBuffer.lineTo(arcEndPointX,arcEndPointY);
            }
 else {
              mPathBuffer.lineTo(center.x,center.y);
            }
          }
        }
        mPathBuffer.close();
        mBitmapCanvas.drawPath(mPathBuffer,mRenderPaint);
      }
    }
    angle+=sliceAngle * phaseX;
  }
  MPPointF.recycleInstance(center);
}