Skip to content

Commit bef8db1

Browse files
committed
Fixed a null exception when using markers with pie chart
1 parent 055b5a6 commit bef8db1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • MPChartLib/src/com/github/mikephil/charting/charts

MPChartLib/src/com/github/mikephil/charting/charts/Chart.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,9 @@ protected void drawMarkers(Canvas canvas) {
670670
int xIndex = highlight.getXIndex();
671671
int dataSetIndex = highlight.getDataSetIndex();
672672

673-
float deltaX = mXAxis.mAxisRange;
673+
float deltaX = mXAxis != null
674+
? mXAxis.mAxisRange
675+
: ((mData == null ? 0.f : mData.getXValCount()) - 1.f);
674676

675677
if (xIndex <= deltaX && xIndex <= deltaX * mAnimator.getPhaseX()) {
676678

0 commit comments

Comments
 (0)