Skip to content

Commit d086fbd

Browse files
authored
fix: potential error in isTryCatchStatement
In some cases the `bodyArg.handler.param` can have the value `null` which causes the line on 42/43 to cause a runtime exception as it tries to access a property `name` on `null`
1 parent 763376b commit d086fbd

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lib/rules/detect-unhandled-async-errors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function isIfWithReturn (bodyArg) {
3939
function isTryCatchStatement (bodyArg) {
4040
return bodyArg.type === 'TryStatement' &&
4141
bodyArg.handler.type === 'CatchClause' &&
42+
bodyArg.handler.param &&
4243
/^(e|err|error|Error|anySpecificError)$/.test(bodyArg.handler.param.name)
4344
}
4445

0 commit comments

Comments
 (0)