summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/search.c b/src/search.c
index b43756f0a5c..e0ca9a5bf6d 100644
--- a/src/search.c
+++ b/src/search.c
@@ -610,7 +610,11 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
int s1, s2;
/* Null string is found at starting position. */
- if (!len)
+ if (len == 0)
+ return pos;
+
+ /* Searching 0 times means don't move. */
+ if (n == 0)
return pos;
if (RE)