genxml: Fix gen_pack_header.py crash when field type is invalid.
authorRafael Antognolli <rafael.antognolli@intel.com>
Fri, 21 Apr 2017 22:11:17 +0000 (15:11 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 24 Apr 2017 22:14:12 +0000 (15:14 -0700)
Just return earlier in that case. Also set prefix to an empty string, so
we don't get to use it undefined.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/genxml/gen_pack_header.py

index 1b1949ff8a50d79e4cf8aa92e7edd5128007b7e9..020dbe40a60d2015a24896cfa81fefb603fff435 100644 (file)
@@ -273,14 +273,14 @@ class Field(object):
             return
         else:
             print("#error unhandled type: %s" % self.type)
+            return
 
         print("   %-36s %s%s;" % (type, self.name, dim))
 
+        prefix = ""
         if len(self.values) > 0 and self.default == None:
             if self.prefix:
                 prefix = self.prefix + "_"
-            else:
-                prefix = ""
 
         for value in self.values:
             print("#define %-40s %d" % (prefix + value.name, value.value))