8000 fix: Make sure that getSession exists before calling it (#3017) · phstc/sentry-javascript@bd6028a · GitHub
[go: up one dir, main page]

Skip to content

Commit bd6028a

Browse files
authored
fix: Make sure that getSession exists before calling it (getsentry#3017)
1 parent 06bf17a commit bd6028a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/core/src/baseclient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
522522
throw new SentryError('`beforeSend` returned `null`, will not send event.');
523523
}
524524

525-
const session = scope && scope.getSession();
525+
const session = scope && scope.getSession && scope.getSession();
526526
if (!isTransaction && session) {
527527
this._updateSessionFromEvent(session, processedEvent);
528528
}

packages/hub/src/hub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export class Hub implements HubInterface {
384384
const { scope, client } = this.getStackTop();
385385
if (!scope) return;
386386

387-
const session = scope.getSession();
387+
const session = scope.getSession && scope.getSession();
388388
if (session) {
389389
session.close();
390390
if (client && client.captureSession) {

0 commit comments

Comments
 (0)
0