diff --git a/misc/json.c b/misc/json.c index 608cfad861..d30450c49d 100644 --- a/misc/json.c +++ b/misc/json.c @@ -255,6 +255,8 @@ static const char special_escape[] = { static void write_json_str(bstr *b, unsigned char *str) { + assert(str); + APPEND(b, "\""); while (1) { unsigned char *cur = str; diff --git a/player/command.c b/player/command.c index 4ac0a4556a..64d1b4d310 100644 --- a/player/command.c +++ b/player/command.c @@ -3605,7 +3605,8 @@ static int mp_property_option_info(void *ctx, struct m_property *prop, union m_option_value def = m_option_value_default; const void *def_ptr = m_config_get_co_default(mpctx->mconfig, co); - if (def_ptr && opt->type->size > 0) + bool has_default = def_ptr && opt->type->size > 0; + if (has_default) memcpy(&def, def_ptr, opt->type->size); bool has_minmax = opt->min < opt->max && @@ -3643,7 +3644,7 @@ static int mp_property_option_info(void *ctx, struct m_property *prop, {"set-from-commandline", SUB_PROP_BOOL(co->is_set_from_cmdline)}, {"set-locally", SUB_PROP_BOOL(co->is_set_locally)}, {"expects-file", SUB_PROP_BOOL(opt->flags & M_OPT_FILE)}, - {"default-value", *opt, def}, + {"default-value", *opt, def, .unavailable = !has_default}, {"min", SUB_PROP_DOUBLE(opt->min), .unavailable = !(has_minmax && opt->min != DBL_MIN)}, {"max", SUB_PROP_DOUBLE(opt->max),