Default layer names to UNSET rather than crashing when unset
See code comment for more info
Fixes #951
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java
index 6169573..87ee517 100644
--- a/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java
+++ b/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java
@@ -35,7 +35,9 @@
}
public static Layer parse(JsonReader reader, LottieComposition composition) throws IOException {
- String layerName = null;
+ // This should always be set by After Effects. However, if somebody wants to minify
+ // and optimize their json, the name isn't critical for most cases so it can be removed.
+ String layerName = "UNSET";
Layer.LayerType layerType = null;
String refId = null;
long layerId = 0;