summaryrefslogtreecommitdiffstats
path: root/text-utils/more.c
diff options
context:
space:
mode:
Diffstat (limited to 'text-utils/more.c')
-rw-r--r--text-utils/more.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/text-utils/more.c b/text-utils/more.c
index 74148a7ab..94b045506 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1605,6 +1605,8 @@ void search(char buf[], FILE *file, register int n)
context.line = saveln = Currline;
context.chrctr = startline;
lncount = 0;
+ if (!buf)
+ goto notfound;
if ((rc = regcomp(&re, buf, REG_NOSUB)) != 0) {
char s[REGERR_BUF];
regerror(rc, &re, s, sizeof s);
@@ -1661,6 +1663,7 @@ void search(char buf[], FILE *file, register int n)
}
free(previousre);
previousre = NULL;
+notfound:
more_error(_("Pattern not found"));
}
}