summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-04-25 12:57:28 +0300
committerUoti Urpala <uau@mplayer2.org>2011-05-02 00:44:21 +0300
commit325926f9f87070615521747646c47012f1434e15 (patch)
tree3b72fab5522ace4029da7256e5dd2b38eb45abde
parented5279db296341d96f94b4b6e9aca719a12327e7 (diff)
downloadmpv-325926f9f87070615521747646c47012f1434e15.tar.bz2
mpv-325926f9f87070615521747646c47012f1434e15.tar.xz
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.
-rw-r--r--command.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/command.c b/command.c
index 8aeff84e63..5b9bf82af2 100644
--- a/command.c
+++ b/command.c
@@ -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