diff options
Diffstat (limited to 'search.c')
-rw-r--r-- | search.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: search.c,v 1.5 2001/12/23 14:44:00 ukai Exp $ */ +/* $Id: search.c,v 1.6 2002/01/11 02:24:13 a-ito Exp $ */ #include "fm.h" #include "regex.h" @@ -23,7 +23,8 @@ forwardSearch(Buffer *buf, char *str) if (l->propBuf[pos] & PC_KANJI2) pos++; #endif - if (regexMatch(&l->lineBuf[pos], l->len - pos, 0) == 1) { + if (pos < l->len && + regexMatch(&l->lineBuf[pos], l->len - pos, 0) == 1) { matchedPosition(&first, &last); buf->pos = first - l->lineBuf; arrangeCursor(buf); |