Skip to content

Commit

Permalink
Prevent negative array index for marks in shiftAnchorPosition()
Browse files Browse the repository at this point in the history
Bug-Debian: #62
  • Loading branch information
tats committed Dec 5, 2016
1 parent 13cca01 commit d57c132
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion anchor.c
Expand Up @@ -551,7 +551,8 @@ shiftAnchorPosition(AnchorList *al, HmarkerList *hl, int line, int pos,
break;
if (a->start.pos > pos) {
a->start.pos += shift;
if (hl && hl->marks && hl->marks[a->hseq].line == line)
if (hl && hl->marks &&
a->hseq >= 0 && hl->marks[a->hseq].line == line)
hl->marks[a->hseq].pos = a->start.pos;
}
if (a->end.pos >= pos)
Expand Down

0 comments on commit d57c132

Please sign in to comment.