mirror of https://github.com/mpv-player/mpv
command.c: fix sub_remove crash
The sub_remove slave command tried to access a NULL pointer when removing an external subtitle file displayed with libass. Fix.
This commit is contained in:
parent
ed5279db29
commit
325926f9f8
|
@ -2668,9 +2668,16 @@ static void remove_subtitle_range(MPContext *mpctx, int start, int count)
|
|||
}
|
||||
for (idx = start; idx < end; idx++) {
|
||||
sub_data *subd = subs[idx];
|
||||
char *filename = "";
|
||||
if (subd)
|
||||
filename = subd->filename;
|
||||
#ifdef CONFIG_ASS
|
||||
if (!subd)
|
||||
filename = ass_tracks[idx]->name;
|
||||
#endif
|
||||
mp_msg(MSGT_CPLAYER, MSGL_STATUS,
|
||||
"SUB: Removed subtitle file (%d): %s\n", idx + 1,
|
||||
filename_recode(subd->filename));
|
||||
filename_recode(filename));
|
||||
sub_free(subd);
|
||||
subs[idx] = NULL;
|
||||
#ifdef CONFIG_ASS
|
||||
|
|
Loading…
Reference in New Issue