mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 23:32:26 +00:00
Check return values of some mp_find_..._config_file function calls for NULL
This commit is contained in:
parent
a36e03781c
commit
c1ddfb5907
@ -123,6 +123,9 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type)
|
||||
FILE *f;
|
||||
char line[CHANNEL_LINE_LEN], *colon;
|
||||
|
||||
if (!filename)
|
||||
return NULL;
|
||||
|
||||
int fields, cnt, pcnt, k;
|
||||
int has8192, has0;
|
||||
dvb_channel_t *ptr, *tmp, chn;
|
||||
@ -799,11 +802,11 @@ dvb_config_t *dvb_get_config(void)
|
||||
break;
|
||||
}
|
||||
|
||||
if((access(conf_file, F_OK | R_OK) != 0)) {
|
||||
if(conf_file && (access(conf_file, F_OK | R_OK) != 0)) {
|
||||
conf_file = talloc_steal(talloc_ctx,
|
||||
mp_find_user_config_file("channels.conf"));
|
||||
|
||||
if((access(conf_file, F_OK | R_OK) != 0)) {
|
||||
if(conf_file && (access(conf_file, F_OK | R_OK) != 0)) {
|
||||
conf_file = talloc_steal(talloc_ctx,
|
||||
mp_find_global_config_file("channels.conf"));
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts)
|
||||
char *default_font = mp_find_user_config_file("subfont.ttf");
|
||||
char *config = mp_find_config_file("fonts.conf");
|
||||
|
||||
if (!mp_path_exists(default_font)) {
|
||||
if (default_font && !mp_path_exists(default_font)) {
|
||||
talloc_free(default_font);
|
||||
default_font = NULL;
|
||||
}
|
||||
@ -334,6 +334,7 @@ ASS_Library *mp_ass_init(struct MPOpts *opts)
|
||||
char *path = mp_find_user_config_file("fonts");
|
||||
priv = ass_library_init();
|
||||
ass_set_message_cb(priv, message_callback, NULL);
|
||||
if (path)
|
||||
ass_set_fonts_dir(priv, path);
|
||||
ass_set_extract_fonts(priv, opts->use_embedded_fonts);
|
||||
talloc_free(path);
|
||||
|
Loading…
Reference in New Issue
Block a user