diff options
-rw-r--r-- | gfx/2d/2D.h | 3 | ||||
-rw-r--r-- | layout/svg/nsSVGMaskFrame.cpp | 3 | ||||
-rw-r--r-- | layout/svg/nsSVGUtils.cpp | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index c1fba3463..e2020dc9e 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -488,6 +488,9 @@ public: /** * Returns a DataSourceSurface with the same data as this one, but * guaranteed to have surface->GetType() == SurfaceType::DATA. + * + * The returning surface might be null, because of OOM or gfx device reset. + * The caller needs to do null-check before using it. */ virtual already_AddRefed<DataSourceSurface> GetDataSurface() override; diff --git a/layout/svg/nsSVGMaskFrame.cpp b/layout/svg/nsSVGMaskFrame.cpp index b8e4b32ae..a22833d61 100644 --- a/layout/svg/nsSVGMaskFrame.cpp +++ b/layout/svg/nsSVGMaskFrame.cpp @@ -274,7 +274,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext, } RefPtr<DataSourceSurface> maskSurface = maskSnapshot->GetDataSurface(); DataSourceSurface::MappedSurface map; - if (!maskSurface->Map(DataSourceSurface::MapType::READ, &map)) { + if (!maskSurface || + !maskSurface->Map(DataSourceSurface::MapType::READ, &map)) { return nullptr; } diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 0bded21ff..b8794a05d 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -685,7 +685,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame, bool isOK = effectProperties.HasNoFilterOrHasValidFilter(); nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame(&isOK); nsSVGMaskFrame *maskFrame = effectProperties.GetFirstMaskFrame(&isOK); - if (!isOK) { + if (!isOK || !maskFrame) { // Some resource is invalid. We shouldn't paint anything. return DrawResult::SUCCESS; } |