1
mirror of https://github.com/mpv-player/mpv synced 2024-08-04 14:59:58 +02:00

find_subfiles: fix really dumb bug causing segfaults

NULL pointer deref when a .sub file with the same filename as the video
file was present.

I was probably half asleep when writing this code.
This commit is contained in:
wm4 2013-09-17 15:33:12 +02:00
parent 95a2151d19
commit 82de39b7d5

View File

@ -208,7 +208,7 @@ static void filter_subidx(struct subfn **slist, int *nsub)
if (case_endswith(fname, ".idx")) {
prev = fname;
} else if (case_endswith(fname, ".sub")) {
if (strncmp(prev, fname, strlen(fname) - 4) == 0)
if (prev && strncmp(prev, fname, strlen(fname) - 4) == 0)
(*slist)[n].priority = -1;
}
}