From: Sean Sobey Date: Sat, 10 Mar 2018 15:57:27 +0000 (+0200) Subject: Add undefined guard for window.devicePixelRatio (#5324) X-Git-Tag: v2.7.3~1^2~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f4b1d9715f3da507893cf145009c729fad3606b;p=thirdparty%2FChart.js.git Add undefined guard for window.devicePixelRatio (#5324) --- diff --git a/src/core/core.helpers.js b/src/core/core.helpers.js index 347fd958e..d49451d18 100644 --- a/src/core/core.helpers.js +++ b/src/core/core.helpers.js @@ -502,7 +502,7 @@ module.exports = function(Chart) { document.defaultView.getComputedStyle(el, null).getPropertyValue(property); }; helpers.retinaScale = function(chart, forceRatio) { - var pixelRatio = chart.currentDevicePixelRatio = forceRatio || window.devicePixelRatio || 1; + var pixelRatio = chart.currentDevicePixelRatio = forceRatio || (typeof window !== 'undefined' && window.devicePixelRatio) || 1; if (pixelRatio === 1) { return; }