From 1bbaa1eed1ec0ee81720c10d4d8f18a3d50aa465 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 15 Aug 2026 16:10:02 +0700 Subject: [PATCH] fix(api): resolve null pointer exceptions in user service --- apps/api/src/app/user/user.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index d74b90ede..ecd4275c2 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -168,25 +168,25 @@ export class UserService { userSettings: settings.settings as UserSettings }); - let referralPartners: ReferralPartner[]; + let referralPartners: ReferralPartner[] = []; if ( this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') && - subscription.type === SubscriptionType.Basic + subscription?.type === SubscriptionType.Basic ) { referralPartners = await this.propertyService.getByKey( PROPERTY_REFERRAL_PARTNERS ); } - let systemMessage: SystemMessage; + let systemMessage: SystemMessage | undefined; const systemMessageProperty = await this.propertyService.getByKey( PROPERTY_SYSTEM_MESSAGE ); - if (systemMessageProperty?.targetGroups?.includes(subscription?.type)) { + if (subscription?.type && systemMessageProperty?.targetGroups?.includes(subscription.type)) { systemMessage = systemMessageProperty; } @@ -194,7 +194,7 @@ export class UserService { if ( this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') && - subscription.type === SubscriptionType.Basic + subscription?.type === SubscriptionType.Basic ) { tags = tags.filter(({ id }) => { return [TAG_ID_DRAFT, TAG_ID_EXCLUDE_FROM_ANALYSIS].includes(id);