From 83caeaae9b4e3b372c943573151bd612f15fe17f Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@gnome.org>
Date: Tue, 17 Mar 2015 13:47:08 +0000
Subject: [PATCH] stage-cogl: Abort realize() if there's no CoglContext

There's no point in trying to go ahead if we don't have a context to
create the CoglOnscreen framebuffer, and Cogl will crash anyway if we
pass NULL to the constructor.
---
 clutter/cogl/clutter-stage-cogl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/clutter/cogl/clutter-stage-cogl.c b/clutter/cogl/clutter-stage-cogl.c
index 5a8c3bd0b..710374e04 100644
--- a/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/cogl/clutter-stage-cogl.c
@@ -135,6 +135,12 @@ clutter_stage_cogl_realize (ClutterStageWindow *stage_window)
 
   backend = clutter_get_default_backend ();
 
+  if (backend->cogl_context == NULL)
+    {
+      g_warning ("Failed to realize stage: missing Cogl context");
+      return FALSE;
+    }
+
   if (stage_cogl->onscreen == NULL)
     {
       stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,