Skip to content

Commit 7c2d22a

Browse files
authored
Merge pull request #330 from StainlessStlRat/master
Prevent crash when updating datasets and calling animation functions
2 parents f360887 + e3f6636 commit 7c2d22a

File tree

1 file changed

+3
-1
lines changed
  • MPChartLib/src/main/java/com/github/mikephil/charting/charts

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,10 @@ protected void drawMarkers(Canvas canvas) {
761761

762762
for (Highlight highlight : mIndicesToHighlight) {
763763

764+
// When changing data sets and calling animation functions, sometimes an erroneous highlight is generated
765+
// on the dataset that is removed. Null check to prevent crash
764766
IDataSet set = mData.getDataSetByIndex(highlight.getDataSetIndex());
765-
if (!set.isVisible()) {
767+
if (set == null || !set.isVisible()) {
766768
continue;
767769
}
768770

0 commit comments

Comments
 (0)