Skip to content

toStruct: set a field to null if the field is nullable and isn't getting set#207

Merged
natecraddock merged 2 commits intonatecraddock:mainfrom
Squibid:toStruct-undefined-memory
Apr 24, 2026
Merged

toStruct: set a field to null if the field is nullable and isn't getting set#207
natecraddock merged 2 commits intonatecraddock:mainfrom
Squibid:toStruct-undefined-memory

Conversation

@Squibid
Copy link
Copy Markdown
Contributor

@Squibid Squibid commented Apr 24, 2026

Since the struct in toStruct is created from undefined memory it does need to be set to something to not have undefined behavior. Maybe it'd be a good idea to make nothing getting set unreachable or perhaps panic?

@Squibid Squibid changed the title set a field to null if the field is nullable and isn't getting set toStruct: set a field to null if the field is nullable and isn't getting set Apr 24, 2026
@Squibid
Copy link
Copy Markdown
Contributor Author

Squibid commented Apr 24, 2026

wow didn't even realize that this bug was already found in #171, I can implement the possible solution from there if no one else wants to otherwise I'll close this and let someone else take a shot at it.

@natecraddock
Copy link
Copy Markdown
Owner

Thanks! I was going to work on #171 soon, but glad to get some help. I think I'd prefer the solution in that issue, so if you want to simplify yours to just be the else then I'll be happy to merge

@natecraddock natecraddock linked an issue Apr 24, 2026 that may be closed by this pull request
@natecraddock natecraddock merged commit 22cad3a into natecraddock:main Apr 24, 2026
3 checks passed
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.

Optional Fields in toStruct do not get null value

2 participants