mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:17:45 +00:00
LibWeb: Add missing nullptr check in HTMLImageElement::bitmap()
Fixes crashing on https://discord.com/login
This commit is contained in:
parent
b2a1f39400
commit
4b23046a22
2 changed files with 8 additions and 1 deletions
|
@ -125,6 +125,13 @@ RefPtr<Gfx::ImmutableBitmap> HTMLImageElement::immutable_bitmap() const
|
||||||
return current_image_bitmap();
|
return current_image_bitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefPtr<Gfx::Bitmap const> HTMLImageElement::bitmap() const
|
||||||
|
{
|
||||||
|
if (auto immutable_bitmap = this->immutable_bitmap())
|
||||||
|
return immutable_bitmap->bitmap();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
Optional<CSSPixels> HTMLImageElement::intrinsic_width() const
|
Optional<CSSPixels> HTMLImageElement::intrinsic_width() const
|
||||||
{
|
{
|
||||||
if (auto image_data = m_current_request->image_data())
|
if (auto image_data = m_current_request->image_data())
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
DeprecatedString src() const { return deprecated_attribute(HTML::AttributeNames::src); }
|
DeprecatedString src() const { return deprecated_attribute(HTML::AttributeNames::src); }
|
||||||
|
|
||||||
RefPtr<Gfx::ImmutableBitmap> immutable_bitmap() const;
|
RefPtr<Gfx::ImmutableBitmap> immutable_bitmap() const;
|
||||||
RefPtr<Gfx::Bitmap const> bitmap() const { return immutable_bitmap()->bitmap(); }
|
RefPtr<Gfx::Bitmap const> bitmap() const;
|
||||||
|
|
||||||
unsigned width() const;
|
unsigned width() const;
|
||||||
WebIDL::ExceptionOr<void> set_width(unsigned);
|
WebIDL::ExceptionOr<void> set_width(unsigned);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue