Fix a crash when adding call events to telemetry

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.
This commit is contained in:
Robin Townsend 2023-04-11 23:05:37 -04:00
parent a2b3e098b6
commit 0637804d61

View file

@ -74,7 +74,7 @@ function flattenVoipEventRecursive(
); );
for (const [k, v] of Object.entries(obj)) { 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; flatObject[prefix + k] = v;
} else if (typeof v === "object") { } else if (typeof v === "object") {
flattenVoipEventRecursive( flattenVoipEventRecursive(