diff options
Diffstat (limited to 'src/fe-common/core/formats.c')
-rw-r--r-- | src/fe-common/core/formats.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index a789c0e3..17c13a97 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -68,7 +68,7 @@ static void format_expand_code(const char **format, GString *out, int *flags) if (flags == NULL) { /* flags are being ignored - skip the code */ - while (**format != ']') + while (**format != ']' && **format != '\0') (*format)++; return; } @@ -246,6 +246,10 @@ int format_expand_styles(GString *out, const char **format, int *flags) case '[': /* code */ format_expand_code(format, out, flags); + if ((*format)[0] == '\0') + /* oops, reached end prematurely */ + (*format)--; + break; case 'x': case 'X': |