diff options
| author | Jon Ashburn <jon@lunarg.com> | 2016-03-10 14:21:09 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2016-03-10 14:24:59 -0700 |
| commit | 108afcfec515867cb6015d5b90ce5210abab7f88 (patch) | |
| tree | e65bd91e6342d08e6f216a71f728cda2427df648 | |
| parent | 37b5dbfd75ff04741d479614f9e88a18b0c348b8 (diff) | |
| download | usermoji-108afcfec515867cb6015d5b90ce5210abab7f88.tar.xz | |
layers: Fix helper script to not dereference strings with a NULL pointer.
Fixes the string helper functions.
Change-Id: I4177e498b734af9188088188a16a09aa2a6113b3
| -rwxr-xr-x | vk_helper.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vk_helper.py b/vk_helper.py index 05e104ee..88f1fa20 100755 --- a/vk_helper.py +++ b/vk_helper.py @@ -1063,7 +1063,11 @@ class StructWrapperGen: 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(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name'])) + sh_funcs.append(' if (pStruct->%s != NULL) {' % 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] << "";' % index) + sh_funcs.append(' }') else: sh_funcs.append('%s' % lineinfo.get()) (po, pa) = self._get_struct_print_formatted(self.struct_dict[s][m]) |
