Skip to content

Commit 4054f33

Browse files
authored
Merge pull request #48 from MindscapeHQ/md/sup-329/fix-runtime-exception
[SUP-329] Do not access modules before the React context is ready
2 parents 856278c + bcd6038 commit 4054f33

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sdk/android/src/main/java/com/raygun/react/RaygunNativeBridgeModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ public void onActivityDestroyed(Activity activity) {
221221
* @param payload - A WritableMap of information to be parsed with this event's occurence.
222222
*/
223223
private void sendJSEvent(String eventType, @Nullable WritableMap payload) {
224+
if (reactContext == null || !reactContext.hasActiveCatalystInstance()) {
225+
Log.w("Raygun", "Unable to send JS event for " + eventType + " due to an inactive React context.");
226+
return;
227+
}
228+
224229
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventType, payload);
225230
}
226231

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "raygun4reactnative",
33
"title": "Raygun4reactnative",
4-
"version": "1.1.3",
4+
"version": "1.1.4",
55
"description": "Raygun React Native SDK",
66
"main": "dist/index.js",
77
"typescript": {

0 commit comments

Comments
 (0)