diff --git a/solhint.js b/solhint.js index eff8b64..aa8ca6e 100755 --- a/solhint.js +++ b/solhint.js @@ -94,7 +94,13 @@ function execMainAction() { } if (printReports(reports, formatterFn)) { - if (program.maxWarnings && !reports[0].errorCount && warningsNumberExceeded) { + if ( + program.maxWarnings && + reports && + reports.length > 0 && + !reports[0].errorCount && + warningsNumberExceeded + ) { console.log( 'Solhint found more warnings than the maximum specified (maximum: %s)', program.maxWarnings