Avoiding ReferenceError when there is no canvas.