]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Assert pointer nonzero in dereferencing operators
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 18 Sep 2009 23:29:12 +0000 (23:29 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 18 Sep 2009 23:29:12 +0000 (23:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@19477 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/smartpointer.h

index 9ee58bc564f8464312d58648619778e8f2eb0bdf..8b2ad54bcb20a7608efe7ba8d773a39a6e11b9ce 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -50,7 +50,7 @@ DEAL_II_NAMESPACE_OPEN
  * <tt>SmartPointer<ABC></tt> is a mutable pointer.
  *
  * @ingroup memory
- * @author Guido Kanschat, Wolfgang Bangerth, 1998 - 2005
+ * @author Guido Kanschat, Wolfgang Bangerth, 1998 - 2009
  */
 template<typename T>
 class SmartPointer
@@ -299,6 +299,7 @@ template <typename T>
 inline
 T & SmartPointer<T>::operator * () const
 {
+  Assert(t != 0, ExcNotInitialized());
   return *t;
 }
 
@@ -308,6 +309,7 @@ template <typename T>
 inline
 T * SmartPointer<T>::operator -> () const
 {
+  Assert(t != 0, ExcNotInitialized());
   return t;
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.