diff --git a/include/boost/python/converter/shared_ptr_to_python.hpp b/include/boost/python/converter/shared_ptr_to_python.hpp index 0002fa91..ac89aad0 100644 --- a/include/boost/python/converter/shared_ptr_to_python.hpp +++ b/include/boost/python/converter/shared_ptr_to_python.hpp @@ -15,7 +15,9 @@ namespace boost { namespace python { namespace converter { template PyObject* shared_ptr_to_python(shared_ptr const& x) { - if (shared_ptr_deleter* d = boost::get_deleter(x)) + if (!x) + return python::detail::none(); + else if (shared_ptr_deleter* d = boost::get_deleter(x)) return incref(d->owner.get()); else return converter::registered const&>::converters.to_python(&x);