Skip to content

Commit 2e69b10

Browse files
committed
fix path list out of bound exception issue.
1 parent 011fc32 commit 2e69b10

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compose-charts/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mavenPublishing{
1515
coordinates(
1616
groupId = "io.github.ehsannarmani",
1717
artifactId = "compose-charts",
18-
version = "0.0.18"
18+
version = "0.0.19"
1919
)
2020
pom{
2121
name.set("Compose Charts")

compose-charts/src/commonMain/kotlin/ir/ehsannarmani/compose_charts/LineChart.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ fun LineChart(
365365
)
366366
}
367367
}
368-
if (linesPathData.isEmpty()) {
368+
if (linesPathData.isEmpty() || linesPathData.count() != data.count()) {
369369
data.map {
370370
getLinePath(
371371
dataPoints = it.values.map { it.toFloat() },
@@ -391,7 +391,7 @@ fun LineChart(
391391
drawZeroLine()
392392
}
393393
data.forEachIndexed { index, line ->
394-
val pathData = linesPathData[index]
394+
val pathData = linesPathData.getOrNull(index) ?: return@Canvas
395395
val segmentedPath = Path()
396396
pathMeasure.setPath(pathData.path, false)
397397
pathMeasure.getSegment(

0 commit comments

Comments
 (0)