Skip to content

Commit a58206e

Browse files
committed
Don't print the default of string if it's NULL
Usually you would make the default of the string NULL only if you want to make it mandatory. In that case there is not much need to display the default at all, 'cause there is no default.
1 parent 6738cbc commit a58206e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flag.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ void flag_print_options(FILE *stream)
262262
fprintf(stream, " Default: %" PRIu64 "\n", flag->def.as_uint64);
263263
break;
264264
case FLAG_STR:
265-
fprintf(stream, " Default: %s\n", flag->def.as_str);
265+
if (flag->def.as_str) {
266+
fprintf(stream, " Default: %s\n", flag->def.as_str);
267+
}
266268
break;
267269
default:
268270
assert(0 && "unreachable");

0 commit comments

Comments
 (0)