Skip to content

Commit

Permalink
fix: add null-check to avoid runtime exceptions under some circumstan…
Browse files Browse the repository at this point in the history
…ces on returned values
  • Loading branch information
wessberg committed Jul 23, 2022
1 parent b79119e commit d89671c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/interpreter/policy/is-trap-condition-met.ts
Expand Up @@ -58,7 +58,7 @@ function handleTrapCondition<T extends object, ConditionType>(
// If matching the condition depends on the provided arguments, pass them in
if (isTrapConditionFunction(trapCondition)) {
const castItem = item as IPolicyProxyApplyHookOptions<T> | IPolicyProxyConstructHookOptions<T>;
return trapCondition(...castItem.argArray) === matchCondition;
return castItem.argArray != null && trapCondition(...castItem.argArray) === matchCondition;
}

// Otherwise, evaluate the truthiness of the condition
Expand Down

0 comments on commit d89671c

Please sign in to comment.