player: avoid undefined behavior when resumign DVD/BD playback

These device options can be NULL, and NULL can't be passed for %s.
This commit is contained in:
wm4 2015-05-09 15:37:05 +02:00
parent 04c02796bd
commit 34ee78f2cb
1 changed files with 3 additions and 3 deletions

View File

@ -184,10 +184,10 @@ static char *mp_get_playback_resume_config_filename(struct mpv_global *global,
realpath = mp_path_join(tmp, cwd, fname);
}
}
if (bstr_startswith0(bfname, "dvd://"))
if (bstr_startswith0(bfname, "dvd://") && opts->dvd_device)
realpath = talloc_asprintf(tmp, "%s - %s", realpath, opts->dvd_device);
if (bstr_startswith0(bfname, "br://") || bstr_startswith0(bfname, "bd://") ||
bstr_startswith0(bfname, "bluray://"))
if ((bstr_startswith0(bfname, "br://") || bstr_startswith0(bfname, "bd://") ||
bstr_startswith0(bfname, "bluray://")) && opts->bluray_device)
realpath = talloc_asprintf(tmp, "%s - %s", realpath, opts->bluray_device);
uint8_t md5[16];
av_md5_sum(md5, realpath, strlen(realpath));