From 108afcfec515867cb6015d5b90ce5210abab7f88 Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Thu, 10 Mar 2016 14:21:09 -0700 Subject: layers: Fix helper script to not dereference strings with a NULL pointer. Fixes the string helper functions. Change-Id: I4177e498b734af9188088188a16a09aa2a6113b3 --- vk_helper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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]) -- cgit v1.2.3