Skip to content

fix: prevent LineChart crash when popup path data is empty#170

Merged
ehsannarmani merged 1 commit into
ehsannarmani:masterfrom
saadkhalidkhan:fix/linechart-empty-data-popup-crash
Jul 11, 2026
Merged

fix: prevent LineChart crash when popup path data is empty#170
ehsannarmani merged 1 commit into
ehsannarmani:masterfrom
saadkhalidkhan:fix/linechart-empty-data-popup-crash

Conversation

@saadkhalidkhan

Copy link
Copy Markdown
Contributor

Summary

  • Guard showPopup against empty data, empty linesPathData, and size mismatches between them
  • Use safe getOrNull access when reading path data per line index
  • Skip popup pointer input when data or path data is not ready yet
  • Update tap gesture pointerInput keys so handlers rebind when chart data changes

This prevents IndexOutOfBoundsException when interacting with a LineChart before path data is populated, or when the chart has no data.

Fixes #146
Fixes #158
Fixes #114

Test plan

  • Build :compose-charts:compileDebugKotlinAndroid locally
  • Render LineChart with an empty data list and drag/tap on the chart — no crash
  • Render LineChart with valid data and verify popup drag/tap still works
  • Toggle chart data from non-empty to empty while popup gestures are enabled — no crash

@saadkhalidkhan saadkhalidkhan force-pushed the fix/linechart-empty-data-popup-crash branch from a98d081 to bfcc760 Compare June 2, 2026 12:21
Guard showPopup and pointer input handlers against empty data and
linesPathData to prevent IndexOutOfBoundsException during drag/tap.

Fixes ehsannarmani#146, ehsannarmani#158, ehsannarmani#114
@saadkhalidkhan saadkhalidkhan force-pushed the fix/linechart-empty-data-popup-crash branch from bfcc760 to d950d1a Compare June 2, 2026 12:22
@ehsannarmani

Copy link
Copy Markdown
Owner

Hi, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants