Skip to content

Commit

Permalink
Fixes crash when chapter is not available on the site
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Dec 14, 2014
1 parent 7c52e26 commit 9bec5bf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/parsers/base.py
Expand Up @@ -203,14 +203,22 @@ def processChapter(self, downloadThread, current_chapter):

# mangafox .js sometimes leaves up invalid chapters
if (url == None):
print('Failed to find '+ self.chapters[current_chapter][1].decode('utf-8')+', skipping to next chapter...')
return

if (self.verbose_FLAG):
print("PrepareDownload: " + url)

source = getSourceCode(url, self.proxy)
max_page_search = self.__class__.re_getMaxPages.search(source)

# MangaHere sometimes leaves up links to invalid chapter and
# the max page search fails
if (max_page_search == None):
print('Failed to find '+ self.chapters[current_chapter][1].decode('utf-8')+', skipping to next chapter...')
return

max_pages = int(self.__class__.re_getMaxPages.search(source).group(1))
max_pages = int(max_page_search.group(1))

if (self.verbose_FLAG):
print ("Pages: "+ str(max_pages))
Expand Down

0 comments on commit 9bec5bf

Please sign in to comment.