History

player/sub: avoid indexing arrays with -1

Kacper Michajłow committed 1 year ago

Commit dddfdf21 parent 442e21a1 file · +3 −1Browse files

Unified · Split

player/sub.c+3−1
@@ -138,7 +138,9 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts, · 137 unmodified lines
138138 // Handle displaying subtitles on terminal.
139139 if (track->selected && track->type == STREAM_SUB && !mpctx->video_out) {
140140 char *text = sub_get_text(dec_sub, video_pts, SD_TEXT_TYPE_PLAIN);
141− term_osd_set_subs(mpctx, text, get_order(mpctx, track));
141+ int order = get_order(mpctx, track);
142+ if (order >= 0)
143+ term_osd_set_subs(mpctx, text, order);
142144 talloc_free(text);
143145 }
144146

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t