@@ -137,6 +137,10 @@ + (void)startWithConfiguration:(BugsnagConfiguration *)config {
137137RCT_EXPORT_MODULE ()
138138
139139RCT_EXPORT_METHOD(notify:(NSDictionary *)options) {
140+ if (![Bugsnag bugsnagStarted ]) {
141+ return ;
142+ }
143+
140144 NSString *const EXCEPTION_TYPE = @" browserjs" ;
141145 NSException *exception = [NSException
142146 exceptionWithName: [RCTConvert NSString: options[@" errorClass" ]]
@@ -181,21 +185,33 @@ + (void)startWithConfiguration:(BugsnagConfiguration *)config {
181185}
182186
183187RCT_EXPORT_METHOD (setUser:(NSDictionary *)userInfo) {
188+ if (![Bugsnag bugsnagStarted ]) {
189+ return ;
190+ }
184191 NSString *identifier = userInfo[@" id" ] ? [RCTConvert NSString: userInfo[@" id" ]] : nil ;
185192 NSString *name = userInfo[@" name" ] ? [RCTConvert NSString: userInfo[@" name" ]] : nil ;
186193 NSString *email = userInfo[@" email" ] ? [RCTConvert NSString: userInfo[@" email" ]] : nil ;
187194 [[Bugsnag configuration ] setUser: identifier withName: name andEmail: email];
188195}
189196
190197RCT_EXPORT_METHOD (startSession) {
198+ if (![Bugsnag bugsnagStarted ]) {
199+ return ;
200+ }
191201 [Bugsnag startSession ];
192202}
193203
194204RCT_EXPORT_METHOD (clearUser) {
205+ if (![Bugsnag bugsnagStarted ]) {
206+ return ;
207+ }
195208 [[Bugsnag configuration ] setUser: nil withName: nil andEmail: nil ];
196209}
197210
198211RCT_EXPORT_METHOD (leaveBreadcrumb:(NSDictionary *)options) {
212+ if (![Bugsnag bugsnagStarted ]) {
213+ return ;
214+ }
199215 [Bugsnag leaveBreadcrumbWithBlock: ^(BugsnagBreadcrumb *crumb) {
200216 crumb.name = [RCTConvert NSString: options[@" name" ]];
201217 crumb.type = BreadcrumbTypeFromString ([RCTConvert NSString: options[@" type" ]]);
@@ -258,6 +274,9 @@ + (void)startWithConfiguration:(BugsnagConfiguration *)config {
258274}
259275
260276- (void )setNotifierDetails : (NSString *)packageVersion {
277+ if (![Bugsnag bugsnagStarted ]) {
278+ return ;
279+ }
261280 id notifier = [Bugsnag notifier ];
262281 NSDictionary *details = [notifier valueForKey: @" details" ];
263282 NSString *version;
0 commit comments