Fix error reporting for lost contexts

Trac #19246
Issue=262

Signed-off-by: Nicolas Capens

git-svn-id: http://angleproject.googlecode.com/svn/trunk@906 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index a38bea9..7882c2a 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 905
+#define BUILD_REVISION 906
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index bad6f41..30055bb 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -2707,10 +2707,7 @@
 
     if (context)
     {
-        if (context->isContextLost())
-            return GL_OUT_OF_MEMORY;
-        else
-            return context->getError();
+        return context->getError();
     }
 
     return GL_NO_ERROR;
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;
 }