diff --git a/ohos_nweb/src/cef_delegate/nweb_event_handler.cc b/ohos_nweb/src/cef_delegate/nweb_event_handler.cc index 7203ef992ba2806a9d8a06bb65bb48b8fca24da0..f1240357372c3f1773a54186eee7bb7bbe78ac99 100644 --- a/ohos_nweb/src/cef_delegate/nweb_event_handler.cc +++ b/ohos_nweb/src/cef_delegate/nweb_event_handler.cc @@ -242,6 +242,10 @@ void NWebEventHandler::SendMouseEvent(int x, mouseEvent.y = y; cef_mouse_button_type_t buttonType = static_cast( NWebInputDelegate::CefConverter("mousebutton", button)); + if (static_cast(buttonType) < 0) { + LOG(ERROR) << "invalid button type " << buttonType; + return; + } mouseEvent.modifiers = input_delegate_.GetModifiers(buttonType); if (browser_ && browser_->GetHost()) {