Skip to content

Commit

Permalink
Fix a crash when adding call events to telemetry
Browse files Browse the repository at this point in the history
Since typeof null is 'object', the flattenVoipEventRecursive function was mistakenly casting nulls to Record<string, unknown> in its typeof v === "object" case, causing Object.entries to explode.
  • Loading branch information
robintown committed Apr 12, 2023
1 parent a2b3e09 commit 0637804
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/otel/OTelGroupCallMembership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 0637804

Please sign in to comment.