Skip to content

Commit 118f104

Browse files
committed
fix(android): crash on missing event request
1 parent 99e236e commit 118f104

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/nssentry.android.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,12 @@ export namespace NSSentry {
368368
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
369369
options.beforeSend(event as any, hint);
370370
}
371-
const map = new java.util.HashMap();
372-
map.put('X-Forwarded-Protocol', 'https');
373-
event.getRequest().setHeaders(map);
371+
372+
if (event.getRequest()) {
373+
const map = new java.util.HashMap();
374+
map.put('X-Forwarded-Protocol', 'https');
375+
event.getRequest().setHeaders(map);
376+
}
374377
// we use this callback to actually try and get the JS stack when a native error is catched
375378
try {
376379
const ex: io.sentry.core.protocol.SentryException = event.getExceptions().get(0);

0 commit comments

Comments
 (0)