diff options
Diffstat (limited to 'src/ui/host/RoutedEventDispatch.h')
-rw-r--r-- | src/ui/host/RoutedEventDispatch.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/host/RoutedEventDispatch.h b/src/ui/host/RoutedEventDispatch.h index ae1421ee..2ab51645 100644 --- a/src/ui/host/RoutedEventDispatch.h +++ b/src/ui/host/RoutedEventDispatch.h @@ -25,6 +25,8 @@ void DispatchEvent( controls::Control* const original_sender, events::RoutedEvent<EventArgs>* (controls::Control::*event_ptr)(), controls::Control* const last_receiver, Args&&... args) { + if (original_sender == nullptr) return; + CRU_UNUSED(event_name) if (original_sender == last_receiver) { @@ -41,7 +43,9 @@ void DispatchEvent( auto parent = original_sender; while (parent != last_receiver) { receive_list.push_back(parent); - parent = parent->GetParent(); + auto p = parent->GetParent(); + assert(!(p == nullptr && last_receiver != nullptr)); + parent = p; } if constexpr (debug_flags::routed_event) { |