diff options
author | wustho <benawiadha@gmail.com> | 2020-09-22 15:14:18 +0700 |
---|---|---|
committer | wustho <benawiadha@gmail.com> | 2020-09-22 15:14:18 +0700 |
commit | 2c8891a2b508d54bc58ad3fe27bd180dec3819e7 (patch) | |
tree | 407d0799824e1b87afbdbe70dd021785d1a7f275 /epy.py | |
parent | 324ae009ea27ea110440ef1805b332910bd83238 (diff) | |
download | epy-2c8891a2b508d54bc58ad3fe27bd180dec3819e7.tar.gz |
Fixed toc entry with missing or empty index location.
Diffstat (limited to 'epy.py')
-rwxr-xr-x | epy.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -209,7 +209,10 @@ class Epub: src = i.get("href") name = "".join(list(i.itertext())) src = src.split("#") - idx = contents.index(unquote(src[0])) + try: + idx = contents.index(unquote(src[0])) + except ValueError: + continue self.toc_entries[0].append(name) self.toc_entries[1].append(idx) if len(src) == 2: @@ -302,7 +305,10 @@ class Mobi(Epub): src = i.get("href") name = "".join(list(i.itertext())) src = src.split("#") - idx = contents.index(unquote(src[0])) + try: + idx = contents.index(unquote(src[0])) + except ValueError: + continue self.toc_entries[0].append(name) self.toc_entries[1].append(idx) if len(src) == 2: |