Skip to content

Commit

Permalink
Check if user if null
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth committed Apr 26, 2024
1 parent 6079e40 commit 636804d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/realm/src/app-services/SyncSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,11 @@ export class SyncSession {
*/
get config(): SyncConfiguration {
return this.withInternal((internal) => {
const user = new User(binding.Helpers.syncUserAsAppUser(internal.user), mockApp);
const appUser = binding.Helpers.syncUserAsAppUser(internal.user);
if (!appUser) {
throw new Error("User is null");
}
const user = new User(appUser, mockApp);
const { partitionValue, flxSyncRequested, customHttpHeaders, clientValidateSsl, sslTrustCertificatePath } =
internal.config;
if (flxSyncRequested) {
Expand Down Expand Up @@ -349,7 +353,11 @@ export class SyncSession {
* Gets the User that this session was created with.
*/
get user() {
return User.get(this.withInternal((internal) => binding.Helpers.syncUserAsAppUser(internal.user)));
const appUser = this.withInternal((internal) => binding.Helpers.syncUserAsAppUser(internal.user));
if (!appUser) {
throw new Error("User is null");
}
return User.get(appUser);
}

/**
Expand Down

0 comments on commit 636804d

Please sign in to comment.