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.
master
C. McEnroe 2021-02-15 18:40:24 -05:00
parent 7130177f9a
commit a92f1260ea
1 changed files with 1 additions and 0 deletions

1
edit.c
View File

@ -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);