Skip to content

Commit

Permalink
handle malformed input strings better
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixKratz committed Aug 30, 2021
1 parent 52cb67c commit e505222
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ static struct bar_line bar_prepare_line(CTFontRef font, char *cstring, struct rg
const void *values[] = { font, kCFBooleanTrue };
CFDictionaryRef attributes = CFDictionaryCreate(NULL, keys, values, array_count(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFStringRef string = CFStringCreateWithCString(NULL, cstring, kCFStringEncodingUTF8);
if (!string) string = CFStringCreateWithCString(NULL, "Warning: Malformed UTF-8 string", kCFStringEncodingUTF8);
CFAttributedStringRef attr_string = CFAttributedStringCreate(NULL, string, attributes);
CTLineRef line = CTLineCreateWithAttributedString(attr_string);

Expand Down

0 comments on commit e505222

Please sign in to comment.