@@ -220,15 +220,19 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) {
220220 if (end) {
221221 // length of the extension string
222222 const size_t len = end - start;
223- // NOTE: we could avoid the copy if we had strnstr.
224- const String8 ext (start, len);
225- // now go through all implementations and look for this extension
226- for (int i = 0 ; i < IMPL_NUM_IMPLEMENTATIONS; i++) {
227- // if we find it, add this extension string to our list
228- // (and don't forget the space)
229- const char * match = strstr (disp[i].queryString .extensions , ext.string ());
230- if (match && (match[len] == ' ' || match[len] == 0 )) {
231- mExtensionString .append (start, len+1 );
223+ if (len) {
224+ // NOTE: we could avoid the copy if we had strnstr.
225+ const String8 ext (start, len);
226+ // now go through all implementations and look for this extension
227+ for (int i = 0 ; i < IMPL_NUM_IMPLEMENTATIONS; i++) {
228+ if (disp[i].queryString .extensions ) {
229+ // if we find it, add this extension string to our list
230+ // (and don't forget the space)
231+ const char * match = strstr (disp[i].queryString .extensions , ext.string ());
232+ if (match && (match[len] == ' ' || match[len] == 0 )) {
233+ mExtensionString .append (start, len+1 );
234+ }
235+ }
232236 }
233237 }
234238 // process the next extension string, and skip the space.
0 commit comments