fix: Avoid crashes when calling JNI method fails
While the proper fix would be to understand why there is an NPE, this mitigates the crash
(CLA signed)
Hi @Titozzz! Thanks for the PR! Could you describe which NPEs you're expecting to catch with this fix? I'm positive to merge / include this try..catch, but just wanted to get some more information about the reason behind it.
@chrfalch Sometime when the screens unmount and I used a canvas the view would just crash. I've setup some breakpoints on the JNI side and when the crash occur they do not trigger so somehow theses function just de-bind or don't exist anymore when the crash occurs. Happy to help fix it in a better way if you want. I have patched package on my side in the meantime
Hi. @Titozzz - I've created a PR containing a huge refactor of the base C++ classes where we've also cleaned up a few memory leaks and crashes from Android - #899 - which you might like to try. It is basically making it super easy to extend and create new Skia based views and native components.
I've made a refactoring in our codebase to depend less on skia but I'll revert back to the commit and try reproducing with the latest version of skia if you want
Closing due to inactivity.