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 NPE for "value" instances and optional fields #10

Merged
merged 2 commits into from
Jun 7, 2022
Merged

Fix NPE for "value" instances and optional fields #10

merged 2 commits into from
Jun 7, 2022

Conversation

Mingun
Copy link
Owner

@Mingun Mingun commented Jun 4, 2022

Move all offsets to a dedicates Span class and remove offset, that should be represent offset of substream in a parent stream. This generally does not work, because Kaitai Struct has ability to set any IO stream for an instance. The proper fix should be on the generator and runtime size -- kaitai-io/kaitai_struct_java_runtime#26.

Introduce a getSpan() method for a node, which could return null in case of

  • if node represents an optional and missed sequential field
  • if node represents an optional and missed "parse" instance
  • if node represents a "value" instance

@pfroud, FYI

@pfroud
Copy link
Contributor

pfroud commented Jun 6, 2022

Looks good to me!

This PR is a better alternative to #7

@Mingun Mingun merged commit 22646ae into master Jun 7, 2022
@Mingun Mingun deleted the span branch June 7, 2022 14:25
@pfroud pfroud mentioned this pull request Jun 7, 2022
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