From 0637804d6179c9782adc57dc57a57ae97f396808 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Tue, 11 Apr 2023 23:05:37 -0400 Subject: [PATCH] Fix a crash when adding call events to telemetry Since typeof null is 'object', the flattenVoipEventRecursive function was mistakenly casting nulls to Record in its typeof v === "object" case, causing Object.entries to explode. --- src/otel/OTelGroupCallMembership.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/otel/OTelGroupCallMembership.ts b/src/otel/OTelGroupCallMembership.ts index f32a075..8c31fba 100644 --- a/src/otel/OTelGroupCallMembership.ts +++ b/src/otel/OTelGroupCallMembership.ts @@ -74,7 +74,7 @@ function flattenVoipEventRecursive( ); for (const [k, v] of Object.entries(obj)) { - if (["string", "number", "boolean"].includes(typeof v)) { + if (["string", "number", "boolean"].includes(typeof v) || v === null) { flatObject[prefix + k] = v; } else if (typeof v === "object") { flattenVoipEventRecursive(