Skip to content

Commit

Permalink
Prevent a crash when using certain layer types like Camera
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Peal committed Apr 5, 2017
1 parent 6730b47 commit edb5499
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.airbnb.lottie;

import android.graphics.PointF;
import android.util.Log;

import org.json.JSONObject;

Expand Down Expand Up @@ -45,7 +46,11 @@ static AnimatableTransform newInstance(JSONObject json, LottieComposition compos
if (anchorJson != null) {
anchorPoint = new AnimatablePathValue(anchorJson.opt("k"), composition);
} else {
throwMissingTransform("anchor");
// Cameras don't have an anchor point property. Although we don't support them, at least
// we won't crash.
Log.w(L.TAG, "Layer has no transform property. You may be using an unsupported " +
"layer type such as a camera.");
anchorPoint = new AnimatablePathValue();
}

JSONObject positionJson = json.optJSONObject("p");
Expand Down

0 comments on commit edb5499

Please sign in to comment.