vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 2ba083490611794be87068d017dc25eb5411c055 parent d86f56d5a2b0884690f7a696f10180cfa1762222 Author: Marc André Tanner <mat@brain-dump.org> Date: Fri, 24 Oct 2014 20:21:07 +0200 Do not crash when given an invalid search pattern Diffstat:
| M | text.c | | | 5 | ++++- |
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/text.c b/text.c @@ -1177,7 +1177,10 @@ Regex *text_regex_new(void) { int text_regex_compile(Regex *regex, const char *string, int cflags) { regex->string = string; - return regcomp(®ex->regex, string, cflags); + int r = regcomp(®ex->regex, string, cflags); + if (r) + regcomp(®ex->regex, "\0\0", 0); + return r; } void text_regex_free(Regex *r) {