Revert the second half of r151257. WebGLRenderingContext::create can return null.
[WebKit-https.git] / Source / WebCore / html / HTMLCanvasElement.cpp
index 1a93bd4289132a9d8e525aa1f5532a05e26c624b..e1a62dc9f74c10b5d6359d7f4ed58f8667f73951 100644 (file)
@@ -209,8 +209,10 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas
                 return 0;
             if (!m_context) {
                 m_context = WebGLRenderingContext::create(this, static_cast<WebGLContextAttributes*>(attrs));
-                // Need to make sure a RenderLayer and compositing layer get created for the Canvas
-                setNeedsStyleRecalc(SyntheticStyleChange);
+                if (m_context) {
+                    // Need to make sure a RenderLayer and compositing layer get created for the Canvas
+                    setNeedsStyleRecalc(SyntheticStyleChange);
+                }
             }
             return m_context.get();
         }