From 82de39b7d59e7863a878f87803d6d1b3346bbf8e Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 17 Sep 2013 15:33:12 +0200 Subject: [PATCH] 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. --- sub/find_subfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c index 691c0148d3..a5b1bdeb22 100644 --- a/sub/find_subfiles.c +++ b/sub/find_subfiles.c @@ -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; } }