layers: Fix issue with api_dump when const char* is null.
authorMark Young <marky@lunarg.com>
Thu, 28 Jan 2016 00:46:16 +0000 (17:46 -0700)
committerMark Young <marky@lunarg.com>
Thu, 28 Jan 2016 20:39:50 +0000 (13:39 -0700)
The pEngineName variable in Hologram was NULL and crashed on my 32-bit run
with the api_dump layer enabled.

vk_helper.py

index ea0b8e7..37dc2da 100755 (executable)
@@ -1004,6 +1004,12 @@ class StructWrapperGen:
                         sh_funcs.append('        ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
                         sh_funcs.append('    else')
                         sh_funcs.append('        ss[%u].str("address");' % (index))
+                    elif 'char' in self.struct_dict[s][m]['type'].lower() and self.struct_dict[s][m]['ptr']:
+                        sh_funcs.append('%s' % lineinfo.get())
+                        sh_funcs.append('    if (NULL != pStruct->%s)' % (self.struct_dict[s][m]['name']))
+                        sh_funcs.append('        ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
+                        sh_funcs.append('    else')
+                        sh_funcs.append('        ss[%u].str("");' % (index))
                     else:
                         sh_funcs.append('%s' % lineinfo.get())
                         (po, pa) = self._get_struct_print_formatted(self.struct_dict[s][m])