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
1 changed files with 1 additions and 1 deletions

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;
}
}