diff --git a/packages/hms-video-store/src/transport/index.ts b/packages/hms-video-store/src/transport/index.ts index 3232c1ec3b..92b8e581d1 100644 --- a/packages/hms-video-store/src/transport/index.ts +++ b/packages/hms-video-store/src/transport/index.ts @@ -497,9 +497,10 @@ export default class HMSTransport { this.joinParameters = undefined; HMSLogger.d(TAG, 'leaving in transport'); try { - this.eventBus.analytics.publish( - AnalyticsEventFactory.getKrispUsage(this.pluginUsageTracker.getPluginUsage('HMSKrispPlugin')!), - ); + const usage = this.pluginUsageTracker.getPluginUsage('HMSKrispPlugin'); + if (usage) { + this.eventBus.analytics.publish(AnalyticsEventFactory.getKrispUsage(usage)); + } this.state = TransportState.Leaving; this.publishStatsAnalytics?.stop(); this.subscribeStatsAnalytics?.stop();