浏览代码

fix lottie crash during wrong input

/siyaoH-1.17-fixLottie
siyao 3 年前
当前提交
d0e351fc
共有 2 个文件被更改,包括 26 次插入3 次删除
  1. 7
      com.unity.uiwidgets/Runtime/ui/painting.cs
  2. 22
      engine/src/lib/ui/painting/skottie.cc

7
com.unity.uiwidgets/Runtime/ui/painting.cs


public class Skottie : NativeWrapper {
public Skottie(string path) {
_setPtr(Skottie_Construct(path));
var Id = Skottie_Construct(path);
if(Id == IntPtr.Zero){
Debug.LogError($"cannot load lottie from {path}, please check file exist and valid");
}else {
_setPtr(Id);
}
}
public override void DisposePtr(IntPtr ptr) {

22
engine/src/lib/ui/painting/skottie.cc


path = (char*)fileOut;
#endif
sk_sp<skottie::Animation> animation_ = skottie::Animation::MakeFromFile(path);
if(animation_ == nullptr){
return nullptr;
}
return fml::MakeRefCounted<Skottie>(animation_);
}

UIWIDGETS_API(Skottie*)
Skottie_Construct(char* path) {
fml::RefPtr<Skottie> skottie = Skottie::Create(path);
if(skottie.get() == nullptr){
return nullptr;
}
Skottie_Dispose(Skottie* ptr) { ptr->Release(); }
Skottie_Dispose(Skottie* ptr) {
if(ptr == nullptr){
return;
}
ptr->Release();
}
if(ptr == nullptr){
return;
}
Skottie_Duration(Skottie* ptr) { return ptr->duration(); }
Skottie_Duration(Skottie* ptr) {
if(ptr == nullptr){
return 0;
}
return ptr->duration(); }
} // namespace uiwidgets
正在加载...
取消
保存