Skip to content

fix: prevent CsvPreviewer crash when CSV data is empty#1681

Open
preetham3127 wants to merge 1 commit into
foss42:mainfrom
preetham3127:fix/csv-previewer-empty-data-crash
Open

fix: prevent CsvPreviewer crash when CSV data is empty#1681
preetham3127 wants to merge 1 commit into
foss42:mainfrom
preetham3127:fix/csv-previewer-empty-data-crash

Conversation

@preetham3127

Copy link
Copy Markdown
Contributor

PR Description

This PR fixes a crash in the CsvPreviewer when the CSV response is empty.

Related Issues

Closes #1647

What I changed

  • Added a guard condition to check if the parsed CSV data is empty
  • Prevented accessing csvData[0] when the list is empty
  • Introduced a simple fallback UI to handle empty CSV data safely

Result

  • The app no longer crashes with a RangeError when CSV data is empty
  • A user-friendly message is displayed instead

Checklist

  • I have gone through the contributing guidelines
  • I have updated my branch and synced it with project main branch before making this PR
  • I am using the latest Flutter stable branch
  • I have run the tests and ensured everything works as expected

Notes

  • Only minimal changes were made
  • No unrelated files were modified

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CsvPreviewer crashes with RangeError when CSV data is empty

1 participant