Skip to content

fix: Remove unsafe cast in ContinuousFlyout#2671

Merged
gonfunko merged 2 commits intomainfrom
toolbox-categories
Jan 14, 2026
Merged

fix: Remove unsafe cast in ContinuousFlyout#2671
gonfunko merged 2 commits intomainfrom
toolbox-categories

Conversation

@gonfunko
Copy link
Contributor

The basics

The details

Resolves

Fixes RaspberryPiFoundation/blockly#8884

Proposed Changes

This PR removes an unsafe cast that was assuming the parent toolbox is always non-null. I wasn't able to reproduce the behavior described in #8884, but the stacktrace indicates that the toolbox was null on one of these lines, so handling that case should resolve it.

@gonfunko gonfunko requested a review from a team as a code owner January 14, 2026 17:35
@gonfunko gonfunko requested review from BenHenning and removed request for a team January 14, 2026 17:35
@gonfunko gonfunko changed the title Toolbox categories fix: Remove unsafe cast in ContinuousFlyout Jan 14, 2026
Copy link
Collaborator

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gonfunko! This seems a reasonable defensive thing to do, though I wonder if the console log should be a bit more warning/error esque to represent the severity of the fact that the configuration is pretty clearly broken in such a case.

@BenHenning
Copy link
Collaborator

Also: I suppose it's possible that the flyout is simply null and not the wrong type, right? The stacktrace, as far as I can tell, is just failing on it being null either due to mismatched type or the value being null (unless I'm misreading it...).

@gonfunko
Copy link
Contributor Author

Yes, it could just be null, in which case this should still not throw. All it was doing was trying to select the first category, and if there is no toolbox that just becomes a no-op now which seems reasonable.

@gonfunko gonfunko merged commit 5d84f65 into main Jan 14, 2026
5 checks passed
@gonfunko gonfunko deleted the toolbox-categories branch January 14, 2026 20:29
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.

Custom Toolbox Categories don't work if you have only custom categories

2 participants