Skip to content

Commit

Permalink
fix: index out of range bug (github-tools#289)
Browse files Browse the repository at this point in the history
The for loop condition needs to depend
on the RANGE, otherwise it the index
will go out of range when we access
i + RANGE - 1 inside the for loop.

Signed-off-by: Harikrishnan Balagopal <[email protected]>
  • Loading branch information
HarikrishnanBalagopal authored Dec 17, 2020
1 parent 8c5affc commit 62c9289
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/src/Gren.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ class Gren {
const labels = Array.from(issue.labels);

if (!labels.length && this.options.template.noLabel) {
labels.push({name: this.options.template.noLabel});
labels.push({ name: this.options.template.noLabel });
}

return labels
Expand Down Expand Up @@ -804,7 +804,7 @@ class Gren {
return;
}

issue.labels.push({name: this.options.template.noLabel});
issue.labels.push({ name: this.options.template.noLabel });
}

const labelName = issue.labels[0].name;
Expand Down Expand Up @@ -849,7 +849,7 @@ class Gren {
const groups = Object.keys(groupBy).reduce((carry, group, i, arr) => {
const groupIssues = issues.filter(issue => {
if (!issue.labels.length && this.options.template.noLabel) {
issue.labels.push({name: this.options.template.noLabel});
issue.labels.push({ name: this.options.template.noLabel });
}

return issue.labels.some(label => {
Expand Down Expand Up @@ -1093,7 +1093,7 @@ class Gren {
});
}

for (let i = 0; i < sortedReleaseDates.length - 1; i++) {
for (let i = 0; i < sortedReleaseDates.length - RANGE + 1; i++) {
const until = sortedReleaseDates[i + 1].date;
ranges.push([
sortedReleaseDates[i],
Expand Down

0 comments on commit 62c9289

Please sign in to comment.