Check that CanvasRenderingContext2D exists before using it - #208