Optimized non-static usage of static buffers.
Validate buffer pointers.
TRAC #14889
Signed-off-by: Daniel Koch

Author:    Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@528 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/geometry/IndexDataManager.cpp b/src/libGLESv2/geometry/IndexDataManager.cpp
index 3beb7a8..f655d79 100644
--- a/src/libGLESv2/geometry/IndexDataManager.cpp
+++ b/src/libGLESv2/geometry/IndexDataManager.cpp
@@ -156,9 +156,14 @@
             }
         }
 
-        indexBuffer->reserveSpace(convertCount * indexSize(format), type);
-
-        void *output = indexBuffer->map(indexSize(format) * convertCount, &streamOffset);
+        void *output = NULL;
+        
+        if (indexBuffer)
+        {
+            indexBuffer->reserveSpace(convertCount * indexSize(format), type);
+            output = indexBuffer->map(indexSize(format) * convertCount, &streamOffset);
+        }
+        
         if (output == NULL)
         {
             ERR("Failed to map index buffer.");