Instabug-React-Native
Instabug-React-Native copied to clipboard
Fix Android initialization with no invocation events
Null check the array before accessing it.
Hi @romanbb, thank you for submitting a PR!
Would you mind sharing the use case where the invocation events need to be passed as null? What is it you want to achieve but can't with the current implementation?
Hi @romanbb, thank you for submitting a PR!
Would you mind sharing the use case where the invocation events need to be passed as null? What is it you want to achieve but can't with the current implementation?
Hey @AliAbdelfattah - sure!
Our use case was that we are including the Instabug library via the RN package. We did not want to load the library for development builds. So we simply omitted the following call when it was a development build:
Instabug.startWithToken(<>, [Instabug.invocationEvent.shake])
And this produced the crash. A third party library shouldn't be causing a crash if not invoked I think. Perhaps a warning, or a more useful exception can be thrown if you feel strongly about the usage of the API and requiring a startWithTokenCall()
.
Thanks @romanbb for this PR! But since v11, the SDK can now be initialized from JS only, you do not need handle this from your Java code anymore.
Here's what you can do for now:
- Check out v11 migration guide and move your code to JS.
- Consider using
Instabug.invocationEvent.none
instead of null or an empty array.