From b6c0f2cac2abdfb0ee495df44006697959c09c36 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 3 Oct 2004 11:04:06 +0000 Subject: 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) --- source4/build/pidl/swig.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source4') 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 { -- cgit