Skip to content

Commit

Permalink
Merge pull request dylanb#28 from antonio83franco/master
Browse files Browse the repository at this point in the history
FIX - preventing negative array size
  • Loading branch information
dylanb committed Sep 13, 2014
2 parents 88bfa58 + 5a2c939 commit 782e9d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 782e9d7

Please sign in to comment.