Add null check for rules in styles function
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.
cool-Blue/saveSvgAsPng,raiyankamal/saveSvgAsPng,bjpop/saveSvgAsPng,cool-Blue/saveSvgAsPng,exupero/saveSvgAsPng,bjpop/saveSvgAsPng,zky829/saveSvgAsPng,raiyankamal/saveSvgAsPng,flamilton/saveSvgAsPng,flamilton/saveSvgAsPng,zky829/saveSvgAsPng,exupero/saveSvgAsPng