diff --git a/chartLib/src/main/kotlin/info/appdev/charting/components/Legend.kt b/chartLib/src/main/kotlin/info/appdev/charting/components/Legend.kt index 96638065..9321faaa 100644 --- a/chartLib/src/main/kotlin/info/appdev/charting/components/Legend.kt +++ b/chartLib/src/main/kotlin/info/appdev/charting/components/Legend.kt @@ -192,6 +192,7 @@ class Legend() : ComponentBase() { val formToTextSpace = formToTextSpace.convertDpToPixel() for (entry in this.entries) { + if (entry == null) continue val formSize = (if (entry.formSize.isNaN()) this.formSize else @@ -365,6 +366,7 @@ class Legend() : ComponentBase() { var i = 0 while (i < entryCount) { val e = entries[i] + if (e == null) { i++; continue } val drawingForm = e.form != LegendForm.NONE val formSize = if (e.formSize.isNaN()) defaultFormSize @@ -425,6 +427,7 @@ class Legend() : ComponentBase() { var i = 0 while (i < entryCount) { val legendEntry = entries[i] + if (legendEntry == null) { i++; continue } val drawingForm = legendEntry.form != LegendForm.NONE val formSize = if (legendEntry.formSize.isNaN()) defaultFormSize