Commit 2dab79bcc2b6e9c3cbd65ede1108651c7c9bef1f

Sylvain Becker 2019-11-16T22:55:36

Fix crash when detecting SIMD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c
index 2916e34..a40fe7f 100644
--- a/src/cpuinfo/SDL_cpuinfo.c
+++ b/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);