Prevent two rare crashes
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/ShapeContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/ShapeContent.java index 4be5563..8d4c862 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/ShapeContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/ShapeContent.java
@@ -64,7 +64,13 @@ return path; } - path.set(shapeAnimation.getValue()); + Path shapeAnimationPath = shapeAnimation.getValue(); + if (shapeAnimationPath == null) { + // It is unclear why this ever returns null but it seems to in rare cases. + // https://github.com/airbnb/lottie-android/issues/1632 + return path; + } + path.set(shapeAnimationPath); path.setFillType(Path.FillType.EVEN_ODD); trimPaths.apply(path);
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java index 3346395..5e7b408 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
@@ -345,6 +345,12 @@ Mask mask = this.mask.getMasks().get(i); BaseKeyframeAnimation<?, Path> maskAnimation = this.mask.getMaskAnimations().get(i); Path maskPath = maskAnimation.getValue(); + if (maskPath == null) { + // This should never happen but seems to happen occasionally. + // There is no known repro for this but is is probably best to just skip this mask if that is the case. + // https://github.com/airbnb/lottie-android/issues/1879 + continue; + } path.set(maskPath); path.transform(matrix);