@@ -208,17 +208,21 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromMpathElem(
208
208
mPathSourceType = ePathSourceType_Mpath;
209
209
210
210
// Use the shape that's the target of our chosen <mpath> child.
211
- SVGGeometryElement* shapeElem = aMpathElem->GetReferencedPath ();
212
- if (shapeElem && shapeElem->HasValidDimensions ()) {
213
- bool ok = shapeElem->GetDistancesFromOriginToEndsOfVisibleSegments (
214
- &mPathVertices );
215
- if (!ok) {
216
- mPathVertices .Clear ();
217
- return ;
218
- }
219
- if (mPathVertices .Length ()) {
220
- mPath = shapeElem->GetOrBuildPathForMeasuring ();
221
- }
211
+ SVGGeometryElement* shape = aMpathElem->GetReferencedPath ();
212
+ if (!shape || !shape->HasValidDimensions ()) {
213
+ return ;
214
+ }
215
+ if (!shape->GetDistancesFromOriginToEndsOfVisibleSegments (&mPathVertices )) {
216
+ mPathVertices .Clear ();
217
+ return ;
218
+ }
219
+ if (mPathVertices .IsEmpty ()) {
220
+ return ;
221
+ }
222
+ mPath = shape->GetOrBuildPathForMeasuring ();
223
+ if (!mPath ) {
224
+ mPathVertices .Clear ();
225
+ return ;
222
226
}
223
227
}
224
228
@@ -237,7 +241,7 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromPathAttr() {
237
241
238
242
mPath = path.BuildPathForMeasuring (1 .0f );
239
243
bool ok = path.GetDistancesFromOriginToEndsOfVisibleSegments (&mPathVertices );
240
- if (!ok || ! mPathVertices .Length () ) {
244
+ if (!ok || mPathVertices .IsEmpty () || ! mPath ) {
241
245
mPath = nullptr ;
242
246
mPathVertices .Clear ();
243
247
}
@@ -265,7 +269,6 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVertices(
265
269
mValueNeedsReparsingEverySample = false ;
266
270
} else {
267
271
// Get path & vertices from basic SMIL attrs: from/by/to/values
268
-
269
272
RebuildPathAndVerticesFromBasicAttrs (aTargetElement);
270
273
mValueNeedsReparsingEverySample = true ;
271
274
}
0 commit comments