]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add undefined guard for window.devicePixelRatio (#5324)
authorSean Sobey <SeanSobey@users.noreply.github.com>
Sat, 10 Mar 2018 15:57:27 +0000 (17:57 +0200)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 10 Mar 2018 15:57:27 +0000 (16:57 +0100)
src/core/core.helpers.js

index 347fd958e8386fc907338ba50be915a2a556312f..d49451d184644a07ce0bc5e81b8c13ab2b1f05f7 100644 (file)
@@ -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;
                }