Add null check for rules in styles function

I had an issue similar to #7. When trying to save a Google Chart, I encountered the same error "Cannot read property 'length' of null", also in Chrome. Added a null check to prevent this from occurring.
Merge pull request #16 from trhall/gh-pages

Add null check for rules in styles function