From ccd1ead71c73912028dc7d925926b4be81f23879 Mon Sep 17 00:00:00 2001 From: Sean Sobey SAHL Date: Thu, 8 Mar 2018 16:00:11 +0200 Subject: [PATCH] Add undefined guard for window.devicePixelRatio --- src/core/core.helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/core.helpers.js b/src/core/core.helpers.js index 347fd958e83..d49451d1846 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; }