mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-28 14:02:51 +00:00
UI: Prevent crash when right clicking on an unloaded image
This commit is contained in:
parent
57479c2d4b
commit
6fd03425b2
Notes:
github-actions[bot]
2025-01-12 19:30:53 +00:00
Author: https://github.com/Gingeh
Commit: 6fd03425b2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3210
Reviewed-by: https://github.com/tcl3 ✅
11 changed files with 43 additions and 20 deletions
|
@ -508,7 +508,11 @@ EventResult EventHandler::handle_mouseup(CSSPixelPoint viewport_position, CSSPix
|
|||
if (is<HTML::HTMLImageElement>(*node)) {
|
||||
auto& image_element = verify_cast<HTML::HTMLImageElement>(*node);
|
||||
auto image_url = image_element.document().encoding_parse_url(image_element.src());
|
||||
m_navigable->page().client().page_did_request_image_context_menu(viewport_position, image_url, "", modifiers, image_element.immutable_bitmap()->bitmap());
|
||||
Optional<Gfx::Bitmap const*> bitmap;
|
||||
if (image_element.immutable_bitmap())
|
||||
bitmap = image_element.immutable_bitmap()->bitmap();
|
||||
|
||||
m_navigable->page().client().page_did_request_image_context_menu(viewport_position, image_url, "", modifiers, bitmap);
|
||||
} else if (is<HTML::HTMLMediaElement>(*node)) {
|
||||
auto& media_element = verify_cast<HTML::HTMLMediaElement>(*node);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue