From a92f1260ea8fa662f0944a4941c8d87b37b15761 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Mon, 15 Feb 2021 18:40:24 -0500 Subject: Don't expand macro if it can't be converted to mbs Otherwise expanding a macro could hit the assertion in editBuffer while converting to mbs for consumption by the rest of the program. --- edit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'edit.c') diff --git a/edit.c b/edit.c index d9b7673..fc23c58 100644 --- a/edit.c +++ b/edit.c @@ -114,6 +114,7 @@ static void macroExpand(void) { if (macro == pos) return; for (size_t i = 0; i < ARRAY_LEN(Macros); ++i) { if (wcsncmp(Macros[i].name, &buf[macro], pos - macro)) continue; + if (wcstombs(NULL, Macros[i].string, 0) == (size_t)-1) continue; delete(false, macro, pos - macro); pos = macro; size_t expand = wcslen(Macros[i].string); -- cgit 1.4.1-2-gfad0