Prevent deref null pointer in shiftAnchorPosition()

Bug-Debian: https://github.com/tats/w3m/issues/40
This commit is contained in:
Tatsuya Kinoshita
2016-11-15 19:40:28 +09:00
parent 06caca13dd
commit a088e0263c

View File

@@ -551,7 +551,7 @@ shiftAnchorPosition(AnchorList *al, HmarkerList *hl, int line, int pos,
break; break;
if (a->start.pos > pos) { if (a->start.pos > pos) {
a->start.pos += shift; a->start.pos += shift;
if (hl->marks[a->hseq].line == line) if (hl && hl->marks && hl->marks[a->hseq].line == line)
hl->marks[a->hseq].pos = a->start.pos; hl->marks[a->hseq].pos = a->start.pos;
} }
if (a->end.pos >= pos) if (a->end.pos >= pos)