Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MatchError when no Styles Exist for Cell #95

Merged
merged 1 commit into from
Aug 26, 2019

Conversation

barakyo
Copy link
Contributor

@barakyo barakyo commented Aug 19, 2019

This address #94

This fixes an error when no styles exist for a cell and we were getting a MatchError due to assuming that Enum.filter call in sax_event_handler would always return at least one element. To fix the error, we're a little safer when handling the result of Enum.filter if a tuple is returned, continue with the existing happy path. In the case that nothing is returned, we simply append a '0' to indicate that there are no styles for that current cell.

Changes:

  • Xlsxir.ParseStyle.sax_event_handler/2 - Safer handling of values
  • Xlsxir.ParseWorksheet.find_styles/2 - Safer handling of expected values
  • Added tests and test file for missing style

This fixes an error when no styles exist for a cell and we were getting a
MatchError due to assuming that Enum.filter call in  `sax_event_handler` would
always return at least one element. To fix the error, we're a little safer when
handling the result of `Enum.filter` if a tuple is returned, continue with the
existing happy path. In the case that nothing is returned, we simply append a
`'0'` to indicate that there are no styles for that current cell.

Changes:
* Xlsxir.ParseStyle.sax_event_handler/2` - Safer handling of values
* Xlsxir.ParseWorksheet.find_styles/2 - Safer handling of expected values
* Added tests and test file for missing style
@jsonkenl jsonkenl merged commit 936cb11 into jsonkenl:master Aug 26, 2019
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.

2 participants