From 50f1e5ed43516dbd1d792757aa0ea5776f767356 Mon Sep 17 00:00:00 2001 From: Francesco Guardiani Date: Wed, 10 Jan 2024 11:22:12 +0100 Subject: [PATCH] Fix missing undefined check (#223) --- src/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index cf44e1af..3e2a7c28 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -72,7 +72,7 @@ export function jsonDeserialize(json: string): T { // When using google.protobuf.Value in RPC handler responses, we want to roughly match the behaviour of JSON.stringify // for example in converting Date objects to a UTC string export function jsonSafeAny(key: string, value: any): any { - if (typeof value.toJSON == "function") { + if (value !== undefined && value !== null && typeof value.toJSON == "function") { return value.toJSON(key) as any; } else if (globalThis.Array.isArray(value)) { // in place replace