pan/midgard: Don't crash with constants on unknown ops
[mesa.git] / src / panfrost / midgard / midgard_print.c
index 85a1d981722742423ebd07ad52f884263a7a6c17..94a0f1a6453a4667be94d753393a8fb2be600a5d 100644 (file)
@@ -110,6 +110,10 @@ mir_print_constant_component(FILE *fp, const midgard_constants *consts, unsigned
         bool is_sint = false, is_uint = false, is_hex = false;
         const char *opname = alu_opcode_props[op].name;
 
+        /* Add a sentinel name to prevent crashing */
+        if (!opname)
+                opname = "unknown";
+
         if (opname[0] == 'u') {
                 /* If the opcode starts with a 'u' we are sure we deal with an
                  * unsigned int operation