Commit de231c7c authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Chromium LUCI CQ

Add null-checks for a few SVGResource accesses

We can get null SVGResource objects if the property references an
external resource while external resources are not allowed (which is the
case for most properties ATM).

Bug: 1158420, 1028063
Change-Id: I9fbd92166250cb2ba954cb754e3b3b0d1c476a73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2589877
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836775}
parent 2308dd3f
......@@ -285,10 +285,13 @@ bool LayoutSVGResourceClipper::FindCycleFromSelf(
// Check nested clip-path.
if (auto* reference_clip =
DynamicTo<ReferenceClipPathOperation>(StyleRef().ClipPath())) {
SVGResourceClient* client = SVGResources::GetClient(*this);
if (reference_clip->Resource()->FindCycle(*client, solver))
// The resource can be null if the reference is external but external
// references are not allowed.
if (SVGResource* resource = reference_clip->Resource()) {
if (resource->FindCycle(*SVGResources::GetClient(*this), solver))
return true;
}
}
return LayoutSVGResourceContainer::FindCycleFromSelf(solver);
}
......
......@@ -110,7 +110,9 @@ bool LayoutSVGResourceContainer::FindCycleInResources(
// This performs a depth-first search for a back-edge in all the
// (potentially disjoint) graphs formed by the referenced resources.
for (const auto& local_resource : resources) {
if (local_resource->FindCycle(*client, solver))
// The resource can be null if the reference is external but external
// references are not allowed.
if (local_resource && local_resource->FindCycle(*client, solver))
return true;
}
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment