Skip to content

Commit c68d42f

Browse files
authored
refactor: Add null fallback for debug logging (#5783)
1 parent d83b35a commit c68d42f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/Sentry/SentryRequestOperation.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#import "SentryClient.h"
33
#import "SentryError.h"
44
#import "SentryHub.h"
5+
#import "SentryInternalDefines.h"
56
#import "SentryLogC.h"
67
#import "SentryOptions.h"
78
#import "SentrySDK+Private.h"
@@ -36,7 +37,10 @@ - (instancetype)initWithSession:(NSURLSession *)session
3637
SENTRY_LOG_DEBUG(@"Request status: %ld", (long)statusCode);
3738
if ([SentrySDKInternal.currentHub getClient].options.debug == YES) {
3839
SENTRY_LOG_DEBUG(@"Request response: %@",
39-
[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
40+
data != nil
41+
? [[NSString alloc] initWithData:SENTRY_UNWRAP_NULLABLE(NSData, data)
42+
encoding:NSUTF8StringEncoding]
43+
: @"<no data>");
4044
}
4145

4246
if (nil != error) {

0 commit comments

Comments
 (0)