diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-06-19 09:28:47 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-06-19 09:28:47 +0200 |
commit | 160ae9889e4d16217a7cca7d930f776f5a645ec8 (patch) | |
tree | 716ebbfbfae8c0609d785910b54d1ade59a2fd06 /include | |
parent | e7c1e48794df85d5cb35d67a1bab7543690f084e (diff) |
Catch illegal null pointer dereferences early
Change-Id: I4d558e9a6e2c4e4d9feb45eb5a3fd01ee322bef8
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/ref.hxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx index 0bf519ecc094..87aed32048f2 100644 --- a/include/tools/ref.hxx +++ b/include/tools/ref.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_TOOLS_REF_HXX #define INCLUDED_TOOLS_REF_HXX +#include <sal/config.h> + +#include <cassert> + #include <tools/toolsdllapi.h> #include <vector> @@ -59,9 +63,9 @@ public: T * operator &() const { return pObj; } - T * operator ->() const { return pObj; } + T * operator ->() const { assert(pObj != 0); return pObj; } - T & operator *() const { return *pObj; } + T & operator *() const { assert(pObj != 0); return *pObj; } operator T *() const { return pObj; } |