Add sanity check for "no previous regular expression" state,

bringed by 'more'
This commit is contained in:
Andrey A. Chernov 1994-09-14 22:25:15 +00:00
parent 28d8923ed0
commit a7f57b7141

View File

@ -59,8 +59,11 @@ char *
re_comp(s)
char *s;
{
if (s == NULL || *s == '\0')
if (s == NULL || *s == '\0') {
if (re_regexp == NULL)
return "no previous regular expression";
return (NULL);
}
if (re_regexp)
free(re_regexp);
if (re_errstr)