diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-07-03 08:23:39 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-07-03 08:24:09 +0200 |
commit | 7bbaa39102367a42ba416db6a578718fc4e7bdf1 (patch) | |
tree | 84f96b45cd377bfb0f5101af23de39eaea8c80f6 /include/com | |
parent | Avoid null this pointers in member function calls (diff) | |
download | core-7bbaa39102367a42ba416db6a578718fc4e7bdf1.tar.gz core-7bbaa39102367a42ba416db6a578718fc4e7bdf1.zip |
Catch invalid null pointer operations early
Change-Id: I324d5a6e84e0d2121d8e4612e074b44ed5127b11
Diffstat (limited to 'include/com')
-rw-r--r-- | include/com/sun/star/uno/Reference.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h index ec45f44ca39b..cedd4721cf18 100644 --- a/include/com/sun/star/uno/Reference.h +++ b/include/com/sun/star/uno/Reference.h @@ -19,8 +19,11 @@ #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H -#include <rtl/alloc.h> +#include <sal/config.h> + +#include <cassert> +#include <rtl/alloc.h> namespace com { @@ -395,8 +398,10 @@ public: @return UNacquired interface pointer */ - inline interface_type * SAL_CALL operator -> () const - { return castFromXInterface(_pInterface); } + inline interface_type * SAL_CALL operator -> () const { + assert(_pInterface != 0); + return castFromXInterface(_pInterface); + } /** Gets interface pointer. This call does not acquire the interface. |