Don't crash if user specified client array of nullptr

3dmark can run into timing/races and do this sort of thing.

Change-Id: Ic75f78d23cb26ebe18142dc78158f5ffb05967fd
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 15106fa..5a3a62d 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -939,6 +939,11 @@
                     continue;
                 }
                 m_glEnableVertexAttribArray_enc(this, i);
+
+                if (datalen && (!offset || !((unsigned char*)offset + firstIndex))) {
+                    ALOGD("%s: bad offset / len!!!!!", __FUNCTION__);
+                    continue;
+                }
                 if (state.isInt) {
                     this->glVertexAttribIPointerDataAEMU(this, i, state.size, state.type, stride, (unsigned char *)offset + firstIndex, datalen);
                 } else {
@@ -1033,7 +1038,6 @@
         ctx->sendVertexAttributes(0, count, false);
         ctx->m_glDrawArrays_enc(ctx, mode, first, count);
     }
-    // ctx->m_stream->flush();
 }
 
 
@@ -1115,7 +1119,6 @@
             ctx->sendVertexAttributes(minIndex, maxIndex - minIndex + 1, true);
             ctx->glDrawElementsData(ctx, mode, count, type, adjustedIndices,
                                     count * glSizeof(type));
-            // ctx->m_stream->flush();
             // XXX - OPTIMIZATION (see the other else branch) should be implemented
             if(!has_indirect_arrays) {
                 //ALOGD("unoptimized drawelements !!!\n");