Author: tpot Date: 2004-10-03 11:04:06 +0000 (Sun, 03 Oct 2004) New Revision: 2805
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2805&nolog=1 Log: Handle NULL pointers when converting structures to Python. All the test cases up till now haven't come across them yet! Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm Changeset: Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm =================================================================== --- branches/SAMBA_4_0/source/build/pidl/swig.pm 2004-10-03 10:31:12 UTC (rev 2804) +++ branches/SAMBA_4_0/source/build/pidl/swig.pm 2004-10-03 11:04:06 UTC (rev 2805) @@ -205,7 +205,10 @@ if ($e->{ARRAY_LEN} or util::has_property($e, "size_is")) { $result .= ArrayToPython($e, $prefix); } else { - $result .= "\tPyDict_SetItemString(obj, \"$e->{NAME}\", $e->{TYPE}_to_python(*s->$prefix$e->{NAME}));\n"; + $result .= "\tif (s->$prefix$e->{NAME})\n"; + $result .= "\t\tPyDict_SetItemString(obj, \"$e->{NAME}\", $e->{TYPE}_to_python(*s->$prefix$e->{NAME}));\n"; + $result .= "\telse\n"; + $result .= "\t\tPyDict_SetItemString(obj, \"$e->{NAME}\", Py_None);\n"; } } } else {