gesture recognizer add nullptr judgement

Signed-off-by: zhouchaobo <zhouchaobo@huawei.com>
Change-Id: I2384b03e97f5e51d8cf1f11aaf23ce3877ffaad9
This commit is contained in:
zhouchaobo 2024-08-16 10:05:37 +08:00
parent e2fdc5ac79
commit 9bda2921c8

View File

@ -389,6 +389,7 @@ void NGGestureRecognizer::HandleWillAccept()
auto node = GetAttachedNode().Upgrade();
if (AceType::InstanceOf<ClickRecognizer>(this)) {
auto clickRecognizer = AceType::DynamicCast<ClickRecognizer>(this);
CHECK_NULL_VOID(clickRecognizer);
GestureEvent gestureEventInfo = clickRecognizer->GetGestureEventInfo();
ClickInfo clickInfo = clickRecognizer->GetClickInfo();
UIObserverHandler::GetInstance().NotifyWillClick(gestureEventInfo, clickInfo, node);
@ -400,6 +401,7 @@ void NGGestureRecognizer::HandleDidAccept()
auto node = GetAttachedNode().Upgrade();
if (AceType::InstanceOf<ClickRecognizer>(this)) {
auto clickRecognizer = AceType::DynamicCast<ClickRecognizer>(this);
CHECK_NULL_VOID(clickRecognizer);
GestureEvent gestureEventInfo = clickRecognizer->GetGestureEventInfo();
ClickInfo clickInfo = clickRecognizer->GetClickInfo();
UIObserverHandler::GetInstance().NotifyDidClick(gestureEventInfo, clickInfo, node);