"git@gitlab.caltech.edu:cs24-19fa/git_rec_nano.git" did not exist on "6240805c4131c350f26f065e832d58f7bac8e0ec"
Commit a8c1dc14 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

rcfile: don't accept empty regexes for syntax coloring


As a small service to the user, reject empty regex strings,
because an entirely empty regex simply doesn't make sense.
Inspired-by: default avatarElia Geretto <elia.f.geretto@gmail.com>
No related merge requests found
Showing with 10 additions and 1 deletion
+10 -1
......@@ -701,6 +701,10 @@ void parse_colors(char *ptr, int rex_flags)
if (ptr == NULL)
break;
if (*fgstr == '\0') {
rcfile_error(N_("Empty regex string"));
goodstart = FALSE;
} else
goodstart = nregcomp(fgstr, rex_flags);
/* If the starting regex is valid, initialize a new color struct,
......@@ -751,6 +755,11 @@ void parse_colors(char *ptr, int rex_flags)
if (ptr == NULL)
break;
if (*fgstr == '\0') {
rcfile_error(N_("Empty regex string"));
continue;
}
/* If the start regex was invalid, skip past the end regex
* to stay in sync. */
if (!goodstart)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment