diff --git a/contrib/cover.js b/contrib/cover.js index 49cf15e..d508922 100644 --- a/contrib/cover.js +++ b/contrib/cover.js @@ -432,7 +432,8 @@ function getSegments(code, lines, count, statementDetails) { // Will now be sorted in start order with end as the second sort criterium splintered = []; for ( i = 0; i < sd.length; i++) { - var us = new Array(sd[i].end - sd[i].start + 1); + var size = (sd[i].end - sd[i].start + 1 < 0) ? 0 : sd[i].end - sd[i].start + 1; + var us = new Array(size); for (k = sd[i].end - sd[i].start; k >= 0; k--) { us[k] = 1; }