From: Dan Vanderkam Date: Fri, 15 Oct 2010 14:36:33 +0000 (-0400) Subject: fix null reference in Chrome X-Git-Tag: v1.0.0~630 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=52e266a37abf70060b7ac7c52b2cedaa8050a092;p=dygraphs.git fix null reference in Chrome --- diff --git a/dygraph.js b/dygraph.js index 6396ef2..89a461f 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2492,7 +2492,8 @@ Dygraph.addAnnotationRule = function() { "background-color: white; " + "text-align: center;"; if (mysheet.insertRule) { // Firefox - mysheet.insertRule(".dygraphDefaultAnnotation { " + rule + " }", mysheet.cssRules.length); + var idx = mysheet.cssRules ? mysheet.cssRules.length : 0; + mysheet.insertRule(".dygraphDefaultAnnotation { " + rule + " }", idx); } else if (mysheet.addRule) { // IE mysheet.addRule(".dygraphDefaultAnnotation", rule); }