Skip to content

Commit d70e065

Browse files
committed
Port upstream fix
1 parent 7c37518 commit d70e065

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/charts/CombinedChart.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.graphics.Canvas
55
import android.util.AttributeSet
66
import android.util.Log
7+
import com.github.mikephil.charting.components.IMarker
78
import com.github.mikephil.charting.data.BarData
89
import com.github.mikephil.charting.data.BubbleData
910
import com.github.mikephil.charting.data.CandleData
@@ -17,6 +18,7 @@ import com.github.mikephil.charting.interfaces.dataprovider.CombinedDataProvider
1718
import com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet
1819
import com.github.mikephil.charting.renderer.CombinedChartRenderer
1920

21+
2022
/**
2123
* This chart class allows the combination of lines, bars, scatter and candle
2224
* data all displayed in one chart area.
@@ -209,11 +211,13 @@ open class CombinedChart : BarLineChartBase<Entry, IBarLineScatterCandleBubbleDa
209211
}
210212

211213
// callbacks to update the content
212-
val markerItem = marker[i % marker.size]
213-
markerItem.refreshContent(e, highlight)
214+
if (!marker.isEmpty()) {
215+
val markerItem: IMarker = marker[i % marker.size]
216+
markerItem.refreshContent(e, highlight)
214217

215-
// draw the marker
216-
markerItem.draw(canvas, pos[0], pos[1])
218+
// draw the marker
219+
markerItem.draw(canvas, pos[0], pos[1])
220+
}
217221
}
218222
}
219223

0 commit comments

Comments
 (0)