summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-10-03 11:04:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:36 -0500
commitb6c0f2cac2abdfb0ee495df44006697959c09c36 (patch)
tree9186006edbebbb2d2d631ef0f6d57b10731a757b /source4
parent0eeb0973e9ccf4583c918562b92a0c8921c122da (diff)
downloadsamba-b6c0f2cac2abdfb0ee495df44006697959c09c36.tar.gz
samba-b6c0f2cac2abdfb0ee495df44006697959c09c36.tar.bz2
samba-b6c0f2cac2abdfb0ee495df44006697959c09c36.zip
r2805: Handle NULL pointers when converting structures to Python. All the
test cases up till now haven't come across them yet! (This used to be commit 5fd3c12d4fe3e572618bcd71c5915f69539fe7e6)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/swig.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm
index b3f2107001..c558287945 100644
--- a/source4/build/pidl/swig.pm
+++ b/source4/build/pidl/swig.pm
@@ -205,7 +205,10 @@ sub FieldToPython($$)
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 {