diff --git a/src/canvas/CanvasProvider.js b/src/canvas/CanvasProvider.js index e5505cf2..715899aa 100644 --- a/src/canvas/CanvasProvider.js +++ b/src/canvas/CanvasProvider.js @@ -29,6 +29,10 @@ var CanvasProvider = { clear = false; // It's already cleared through createElement(). } var ctx = canvas.getContext('2d'); + if (!ctx) { + throw new Error('Canvas ' + canvas + + ' is unable toprovide a 2D context.'); + } // If they are not the same size, we don't need to clear them // using clearRect and visa versa. if (canvas.width === width && canvas.height === height) {