Skip to content

fix/set object type correctly - #106

Merged
mikee47 merged 1 commit into
mikee47:feature/json-rpcfrom
pljakobs:fix/infoVersion
Sep 4, 2026
Merged

fix/set object type correctly#106
mikee47 merged 1 commit into
mikee47:feature/json-rpcfrom
pljakobs:fix/infoVersion

Conversation

@pljakobs

@pljakobs pljakobs commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

the rgbww sample app used
auto req = update.toColor().params.toRaw(); and similar calls
to set the params enum to the correct type.
However, in the chained call, that was only applied to a temporary object, leading to a segfault when writing to it.
this fix changes this as follows, creating a real object and setting it's type correctly.

		auto colorObject = update.toColor();
		auto req = colorObject.params.toRaw();

@mikee47
mikee47 merged commit 924ccdf into mikee47:feature/json-rpc Sep 4, 2026
18 checks passed
@mikee47

mikee47 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Good catch. It would be nice if there were a way to get the compiler to catch this sort of problem!

@pljakobs

pljakobs commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

indeed, I assume the segfault is a blessing in this case, it could also have happened silently if the written datatype had fit into the memory location.

@mikee47

mikee47 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

NB. If you build with ENABLE_SANITIZERS=1 it'll catch this sort of thing: I must remember to do that more often!

mikee47 pushed a commit that referenced this pull request Sep 4, 2026
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