Skip to content

Commit

Permalink
fix: Default inside JSON parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ramedina86 committed Sep 30, 2024
1 parent 5adc442 commit 44f3829
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ui/src/renderer/useEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export function useEvaluator(wf: Core) {
try {
parsedValue = JSON.parse(evaluated);
} catch {
return JSON.parse(defaultValue) ?? null;
return JSON.parse(defaultValue ?? null);
}
return parsedValue;
} else if (fieldType == FieldType.Number) {
Expand All @@ -183,7 +183,7 @@ export function useEvaluator(wf: Core) {
if (isValueEmpty) return floatDefaultValue ?? null;

const n = parseFloat(evaluated);
if (typeof n === undefined || Number.isNaN(n))
if (typeof n === "undefined" || Number.isNaN(n))
return floatDefaultValue ?? null;
return n;
} else if (fieldType == FieldType.IdKey) {
Expand Down

0 comments on commit 44f3829

Please sign in to comment.