panfrost/midgard: Fix crash on unknown op
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 30 Apr 2019 05:06:18 +0000 (05:06 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 4 May 2019 19:08:50 +0000 (19:08 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/helpers.h

index 6d35f4de02547af2e981711a8cc7687935ebb621..d2855cd89cdced465307388752905c9909dde9e1 100644 (file)
@@ -264,6 +264,10 @@ static struct {
 static bool
 midgard_is_integer_op(int op)
 {
-        char prefix = alu_opcode_props[op].name[0];
-        return (prefix == 'i') || (prefix == 'u');
+        const char *name = alu_opcode_props[op].name;
+
+        if (!name)
+                return false;
+
+        return (name[0] == 'i') || (name[0] == 'u');
 }