Skip to content

Commit 1e4a03f

Browse files
Add checks for when Trace is nil
1 parent bbe82cf commit 1e4a03f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ios/RNInstabug/InstabugAPMBridge.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,23 @@ - (id) init
4949

5050
RCT_EXPORT_METHOD(startExecutionTrace:(NSString *)name :(NSString *)id) {
5151
IBGExecutionTrace *trace = [IBGAPM startExecutionTraceWithName:name];
52-
[traces setObject: trace forKey: id];
52+
if (trace != nil) {
53+
[traces setObject: trace forKey: id];
54+
}
5355
}
5456

5557
RCT_EXPORT_METHOD(setExecutionTraceAttribute:(NSString *)id :(NSString *)key :(NSString *)value) {
5658
IBGExecutionTrace *trace = [traces objectForKey:id];
57-
[trace setAttributeWithKey:key value:value];
59+
if (trace != nil) {
60+
[trace setAttributeWithKey:key value:value];
61+
}
5862
}
5963

6064
RCT_EXPORT_METHOD(endExecutionTrace:(NSString *)id) {
6165
IBGExecutionTrace *trace = [traces objectForKey:id];
62-
[trace end];
66+
if (trace != nil) {
67+
[trace end];
68+
}
6369
}
6470

6571
RCT_EXPORT_METHOD(startUITrace:(NSString *)name) {

0 commit comments

Comments
 (0)