Skip to content

Guard against None event in execute_node mode check - #477

Merged
muchimi merged 1 commit into
muchimi:developfrom
Raz0rLegend:fix/execute-node-none-event-guard
Sep 9, 2026
Merged

Guard against None event in execute_node mode check#477
muchimi merged 1 commit into
muchimi:developfrom
Raz0rLegend:fix/execute-node-none-event-guard

Conversation

@Raz0rLegend

Copy link
Copy Markdown
Contributor

Problem

'NoneType' object has no attribute 'mode' in execute_node, reached from a
tempo container's worker thread.

Cause

if event.mode and ... runs without verifying event is not None.

Fix

if event is not None and event.mode and .... Defensive: an execution node
should not crash on a null event. (The root cause of the null event is
fixed separately in the tempo container; this guard is belt-and-braces.)

@muchimi

muchimi commented Aug 23, 2026

Copy link
Copy Markdown
Owner

This is interesting as an execution node can only execute if an event is passed to it.
I'm not able to repro a situation where an event is not passed, so please share your use-case as to how you got that to happen as the fix is likely somewhere else.

I will however add a handler for this situation so GEX logs the stack for diagnostics.

@Raz0rLegend

Copy link
Copy Markdown
Contributor Author

Thanks for looking into it. You're right that the null event comes from
elsewhere — it's the tempo container's short-press worker thread.

The scenario: a tempo container sits on a button that also switches modes.
The tempo records event_press only on the press branch. After a mode
switch, a new tempo functor instance in the target mode receives the
release whose press was handled by the previous mode's instance, so
event_press is still None. The short-press thread then forwards that None
event, which reaches execute_node (event.mode) and play_sound
(event.is_pressed).

I've submitted the actual root-cause fix separately in #475 (guard the
short-press firing on event_press is not None), which you've already
merged — so with #475 in place this None event should no longer occur.

This PR is therefore just belt-and-braces / defensive, matching your plan
to log the stack for diagnostics. Happy to close it if you'd prefer the
diagnostic handler you mentioned instead of the guard.

@muchimi
muchimi merged commit 50e4bd1 into muchimi:develop Sep 9, 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