diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2016-12-20 16:41:57 +0100 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2016-12-20 16:41:57 +0100 |
commit | 7dc2f832c19d8b5c682f5c9abd106ab6be53bf62 (patch) | |
tree | b2b7d2c8640fc04c34a4035168ee6186d816e5eb | |
parent | 1c6695107c09e8861a696d66b029e7df62589fcd (diff) | |
download | irssi-7dc2f832c19d8b5c682f5c9abd106ab6be53bf62.zip |
fix %[
-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 a58d839a..9ce9bce5 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': |