From 4d8dc6a6a94e2f23948fcba7e2281d261cc6a22e Mon Sep 17 00:00:00 2001 From: Kaustubh Kumar Date: Thu, 21 Mar 2024 12:26:33 +0530 Subject: [PATCH] fix: send krisp event if usage > 0 --- packages/hms-video-store/src/transport/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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();