opengles emulator: fix GLESv2 shader source packing

fix segfault when calling glShaderSouce with
empty shader string, length=NULL and count>0

Change-Id: I4c9738d7726fbce22d1e84420faa2bfd772943c5
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
index f07e9ae..6bd3c9f 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
@@ -373,13 +373,15 @@
     char *p = ptr;
     *p = '\0';
     for (int i = 0; i < count; i++) {
-        int l;
-        if (length == NULL || length[i] < 0) {
-            l = strlen(strings[i]);
-            strcat(p, strings[i]);
-        } else {
-            l = length[i];
-            strncat(p, strings[i], l);
+        int l=0;
+        if (strings[i]!=NULL) {
+            if (length == NULL || length[i] < 0) {
+                l = strlen(strings[i]);
+                strcat(p, strings[i]);
+            } else {
+                l = length[i];
+                strncat(p, strings[i], l);
+            }
         }
         p += l;
     }
@@ -392,7 +394,7 @@
     for (int i = 0; i < count; i++) {
         int l;
         if (length == NULL || length[i] < 0) {
-            l = strlen(strings[i]);
+            l = strings[i]!=NULL ? strlen(strings[i]) : 0;
         } else {
             l = length[i];
         }