Fix error reporting for lost contexts

Trac #19246
Issue=262

Signed-off-by: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@906 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/main.cpp b/src/libGLESv2/main.cpp
index affab7a..154d277 100644
--- a/src/libGLESv2/main.cpp
+++ b/src/libGLESv2/main.cpp
@@ -98,9 +98,18 @@
 {
     Context *context = getContext();
     
-    if (context && !context->isContextLost())
-        return context;
-
+    if (context)
+    {
+        if (context->isContextLost())
+        {
+            error(GL_OUT_OF_MEMORY);
+            return NULL;
+        }
+        else
+        {
+            return context;
+        }
+    }
     return NULL;
 }