Browse Source

Fix crash when detecting SIMD

Sylvain Becker 5 years ago
parent
commit
2dab79bcc2
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/cpuinfo/SDL_cpuinfo.c

+ 4 - 2
src/cpuinfo/SDL_cpuinfo.c

@@ -362,8 +362,10 @@ CPU_haveARMSIMD(void)
             if (aux.a_type == AT_PLATFORM)
             {
                 const char *plat = (const char *) aux.a_un.a_val;
-                arm_simd = strncmp(plat, "v6l", 3) == 0 ||
-                           strncmp(plat, "v7l", 3) == 0;
+                if (plat) {
+                    arm_simd = strncmp(plat, "v6l", 3) == 0 ||
+                               strncmp(plat, "v7l", 3) == 0;
+                }
             }
         }
         close(fd);