[Orxonox-commit 1086] r5807 - code/branches/core5/src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Sep 27 12:53:49 CEST 2009


Author: rgrieder
Date: 2009-09-27 12:53:49 +0200 (Sun, 27 Sep 2009)
New Revision: 5807

Modified:
   code/branches/core5/src/libraries/core/SmartPtr.h
Log:
- Added OrxonoxClass include to the SmartPtr since that is needed in any case.
- Inserted asserts for operators * and -> to avoid segfaults and instead have a clean abort (in debug mode anyway).

Modified: code/branches/core5/src/libraries/core/SmartPtr.h
===================================================================
--- code/branches/core5/src/libraries/core/SmartPtr.h	2009-09-27 02:13:13 UTC (rev 5806)
+++ code/branches/core5/src/libraries/core/SmartPtr.h	2009-09-27 10:53:49 UTC (rev 5807)
@@ -33,7 +33,9 @@
 
 #include "CorePrereqs.h"
 
+#include <cassert>
 #include <ostream>
+#include "OrxonoxClass.h"
 
 namespace orxonox
 {
@@ -111,11 +113,13 @@
 
             inline T* operator->() const
             {
+                assert(this->pointer_ != 0);
                 return this->pointer_;
             }
 
             inline T& operator*() const
             {
+                assert(this->pointer_ != 0);
                 return *this->pointer_;
             }
 




More information about the Orxonox-commit mailing list