Fixed rules.length null error

Some Chrome Extension add style sheets to the page and the rules can't
be access or return null.
Merge pull request #132 from davidtme/master

Fixed rules.length null error