From 103d78d368f6920226cecc065c87fa194cbbab5f Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 30 Sep 2016 13:43:19 +0200 Subject: [PATCH] failed implicit conversions shouldn't lead to nullptr dereference --- include/pybind11/cast.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 7ddd384d..d1f6b250 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -160,6 +160,8 @@ public: : typeinfo(get_type_info(type_info, false)) { } PYBIND11_NOINLINE bool load(handle src, bool convert) { + if (!src) + return false; return load(src, convert, Py_TYPE(src.ptr())); }