From 408f15954e9d36ea7dfe9f85dae845b4ed5780c4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 6 Apr 2019 10:03:52 +0200 Subject: [PATCH] feedback: replace an assert with a check plus error message at startup --- src/rcfile.c | 3 +++ src/search.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rcfile.c b/src/rcfile.c index 674195a1..dd7d7d72 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1130,6 +1130,9 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) if (has_blank_char(option)) { rcfile_error(N_("Non-blank characters required")); free(option); + } else if (mbstrlen(option) % 2 != 0) { + rcfile_error(N_("Even number of characters required")); + free(option); } else matchbrackets = option; } else if (strcasecmp(rcopts[i].name, "whitespace") == 0) { diff --git a/src/search.c b/src/search.c index 4aaf42f5..723088ce 100644 --- a/src/search.c +++ b/src/search.c @@ -943,8 +943,6 @@ void do_find_bracket(void) bool reverse; /* The direction we search. */ - assert(mbstrlen(matchbrackets) % 2 == 0); - ch = mbstrchr(matchbrackets, openfile->current->data + openfile->current_x); if (ch == NULL) {