summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--subreader.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/subreader.c b/subreader.c
index 4522c8c428..3bc8f583aa 100644
--- a/subreader.c
+++ b/subreader.c
@@ -1045,11 +1045,13 @@ static iconv_t icdsc = (iconv_t)(-1);
void subcp_open_noenca ()
{
char enca_lang[100], enca_fallback[100];
- if (sscanf(sub_cp, "enca:%2s:%s", enca_lang, enca_fallback) == 2
- || sscanf(sub_cp, "ENCA:%2s:%s", enca_lang, enca_fallback) == 2) {
- subcp_open(enca_fallback);
- } else {
- subcp_open(sub_cp);
+ if (sub_cp) {
+ if (sscanf(sub_cp, "enca:%2s:%s", enca_lang, enca_fallback) == 2
+ || sscanf(sub_cp, "ENCA:%2s:%s", enca_lang, enca_fallback) == 2) {
+ subcp_open(enca_fallback);
+ } else {
+ subcp_open(sub_cp);
+ }
}
}
#else