From 558a204832fd8c8e5321eb2ab19c67c24ce24ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 3 Jan 2019 01:16:46 +0100 Subject: [PATCH] Add null-pointer checks --- include/boost/intrusive/detail/hook_traits.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/boost/intrusive/detail/hook_traits.hpp b/include/boost/intrusive/detail/hook_traits.hpp index 7a6f206..7f7dc27 100644 --- a/include/boost/intrusive/detail/hook_traits.hpp +++ b/include/boost/intrusive/detail/hook_traits.hpp @@ -57,26 +57,34 @@ struct bhtraits_base BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(const node_ptr & n) { - return pointer_traits::pointer_to + pointer p = pointer_traits::pointer_to (static_cast(static_cast(*n))); + BOOST_ASSERT(!!p); + return p; } BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const const_node_ptr & n) { - return pointer_traits::pointer_to + const_pointer p = pointer_traits::pointer_to (static_cast(static_cast(*n))); + BOOST_ASSERT(!!p); + return p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr(reference value) { - return pointer_traits::pointer_to + node_ptr p = pointer_traits::pointer_to (static_cast(static_cast(value))); + BOOST_ASSERT(!!p); + return p; } BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr(const_reference value) { - return pointer_traits::pointer_to + const_node_ptr p = pointer_traits::pointer_to (static_cast(static_cast(value))); + BOOST_ASSERT(!!p); + return p; } };