Skip to content

Commit 50f1e5e

Browse files
Fix missing undefined check (#223)
1 parent a5c8aaf commit 50f1e5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function jsonDeserialize<T>(json: string): T {
7272
// When using google.protobuf.Value in RPC handler responses, we want to roughly match the behaviour of JSON.stringify
7373
// for example in converting Date objects to a UTC string
7474
export function jsonSafeAny(key: string, value: any): any {
75-
if (typeof value.toJSON == "function") {
75+
if (value !== undefined && value !== null && typeof value.toJSON == "function") {
7676
return value.toJSON(key) as any;
7777
} else if (globalThis.Array.isArray(value)) {
7878
// in place replace

0 commit comments

Comments
 (0)