Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Avoid IndexError when no video description is present #1

Closed
wants to merge 2 commits into from

Conversation

alukach
Copy link

@alukach alukach commented Jan 17, 2014

This plugin stopped working a few weeks ago on my machine (unable to view 'All Shows'). After some investigation, I noticed that an IndexError was being raised from listShows(). This occurs due to the fact that the Vice: Shows page has a show listed without a description:

<li class="story story-square">
    <a class="story_thumbnail" href="/every-woman"><img width="220" height="220" src="http://assets.vice.com/content-images/series/every-woman/show_image/showtrailer_vice_220x220.jpg" /></a>    <h2><a href="/every-woman">Every Woman</a></h2>
    <p></p>
</li>

When the regex encounters the empty <p> tag, it returns an empty string as the match. When the following line attempts to get the 0 index of that empty string, an IndexError occurs.

These changes return a list object with an empty string at the 0 index when no match is found by regex, thus avoiding the IndexError.

This bug could theoretically occur anywhere where the results of a regex are accessed at index 0 without first scrutinizing the results.

ps: I love this plugin! Thanks for putting it up in the first place! (:thumbsup:)

If no video description is encoded, the regex will return an empty string (ie ''), which will cause an IndexError when trying to access ''[0].  This will now return a list with an empty string at index 0 if no match is found via regex.
@AddonScriptorDE
Copy link
Owner

Jep, forgot to add the fix to github / xbmc.org repo.
It's currently only available via my testing-repo:
http://code.google.com/p/addonscriptorde-beta-repo/downloads/detail?name=repository.addonscriptorde-beta.zip&can=2&q=
Should be available via xbmc.org soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants