Added extra null check in HtmlImageLayerCanvas.paint.