diff options
author | crupest <crupest@outlook.com> | 2022-02-16 22:42:34 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-16 22:42:34 +0800 |
commit | f75ab0bd662c73d15057d746347d09bf94a992a6 (patch) | |
tree | 91efc33de481edf5304001d80b914b69cc0fb338 /src/ui/host/RoutedEventDispatch.h | |
parent | 2711b7032cafdc9bdbd6ae06db0325c91e6e7f63 (diff) | |
download | cru-f75ab0bd662c73d15057d746347d09bf94a992a6.tar.gz cru-f75ab0bd662c73d15057d746347d09bf94a992a6.tar.bz2 cru-f75ab0bd662c73d15057d746347d09bf94a992a6.zip |
...
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) { |