diff options
| author | Jon Ashburn <jon@lunarg.com> | 2015-02-25 12:45:23 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2015-02-25 16:53:34 -0700 |
| commit | b9f69c7073f0c3aa68878f7cc80fed0f53c986f5 (patch) | |
| tree | 771eb2d6dfbdce81aecaab7f91651702f9a18367 | |
| parent | 75a68beb7cd59e60935f7030bf55f8a7aab5ceff (diff) | |
| download | usermoji-b9f69c7073f0c3aa68878f7cc80fed0f53c986f5.tar.xz | |
layers: Check for NULL pointer with dynamic_display()
| -rwxr-xr-x | xgl_helper.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/xgl_helper.py b/xgl_helper.py index d372371e..6b6a1d1c 100755 --- a/xgl_helper.py +++ b/xgl_helper.py @@ -615,6 +615,8 @@ class StructWrapperGen: # Add function to dynamically print out unknown struct sh_funcs.append("char* dynamic_display(const void* pStruct, const char* prefix)\n{\n") sh_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct\n") + sh_funcs.append(" if (pStruct == NULL)\n") + sh_funcs.append(" return NULL;\n") sh_funcs.append(" XGL_STRUCTURE_TYPE sType = ((XGL_APPLICATION_INFO*)pStruct)->sType;\n") sh_funcs.append(' char indent[100];\n strcpy(indent, " ");\n strcat(indent, prefix);\n') sh_funcs.append(" switch (sType)\n {\n") @@ -758,6 +760,8 @@ class StructWrapperGen: # Add function to dynamically print out unknown struct sh_funcs.append("string dynamic_display(const void* pStruct, const string prefix)\n{") sh_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct") + sh_funcs.append(" if (pStruct == NULL)") + sh_funcs.append(" return NULL;") sh_funcs.append(" XGL_STRUCTURE_TYPE sType = ((XGL_APPLICATION_INFO*)pStruct)->sType;") sh_funcs.append(' string indent = " ";') sh_funcs.append(' indent += prefix;') |
