From 7d3c6b31e7768cd0eaa89a272e7a41f025fae625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 7 Oct 2019 06:55:00 -0400 Subject: [PATCH] Fix for index out of range when no extension in filename. --- libs/subliminal_patch/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py index 77bcd1397..bcfef632b 100644 --- a/libs/subliminal_patch/core.py +++ b/libs/subliminal_patch/core.py @@ -612,7 +612,10 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen forced = "forced" in adv_tag # extract the potential language code - language_code = p_root.rsplit(".", 1)[1].replace('_', '-') + try: + language_code = p_root.rsplit(".", 1)[1].replace('_', '-') + except IndexError: + language_code = None # remove possible language code for matching p_root_bare = ENDSWITH_LANGUAGECODE_RE.sub("", p_root)