#20 Refactor - Declare "lottie" as nullable#21
Conversation
| length: Int, | ||
| outValues: IntArray? | ||
| ): Long | ||
|
|
There was a problem hiding this comment.
Since content and outValues are nullable, the current implementation of
Java_org_thorvg_lottie_LottieDrawable_nCreateLottie in lottie-libs.cpp can crash because it does not perform any null checks.
Please add null-safety checks to Java_org_thorvg_lottie_LottieDrawable_nCreateLottie, for example:
extern "C" jlong
Java_org_thorvg_lottie_LottieDrawable_nCreateLottie(JNIEnv *env, jclass clazz,
jstring content, jint length, jintArray out_values) {
if (content == nullptr || inputStr == nullptr) {
return 0;
}
...
}
ol-of
left a comment
There was a problem hiding this comment.
I’ve left comments regarding the parts that could potentially cause a crash.
For now, please either revert the changes to nCreateLottie or add proper null-checks (NPE handling) in Java_org_thorvg_lottie_LottieDrawable_nCreateLottie.
I added null-safety checks to |
issue #20