Skip to content

Commit

Permalink
Fix missing undefined check (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper authored Jan 10, 2024
1 parent a5c8aaf commit 50f1e5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function jsonDeserialize<T>(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
Expand Down

0 comments on commit 50f1e5e

Please sign in to comment.