parse_options(): Avoid passing NULL as a string arg to fprintf

This commit is contained in:
Jeff Downs 2011-06-23 14:12:37 -04:00
parent f925b24381
commit f6d28cf029

View File

@ -281,7 +281,7 @@ unknown_opt:
*po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
} else if (po->u.func_arg) {
if (po->u.func_arg(opt, arg) < 0) {
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg ? arg : "[null]", opt);
exit(1);
}
}