]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Do not access the first element if the vector is empty.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Jul 2011 14:50:22 +0000 (14:50 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Jul 2011 14:50:22 +0000 (14:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@23928 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/petsc_parallel_vector.cc

index f2737d80b191173e1c075460e49cc6c3a28a7971..7a8968acf347b48702799cd25f513abd87fa2db3 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2004, 2006, 2008, 2009, 2010 by the deal.II authors
+//    Copyright (C) 2004, 2006, 2008, 2009, 2010, 2011 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -226,7 +226,12 @@ namespace PETScWrappers
       std::vector<unsigned int> ghostindices;
       ghostnodes.fill_index_vector(ghostindices);
       
-      const PetscInt * ptr= (const PetscInt*)(&(ghostindices[0]));
+      const PetscInt * ptr
+       = (ghostindices.size() > 0
+          ?
+          (const PetscInt*)(&(ghostindices[0]))
+          :
+          0);
 
       int ierr
        = VecCreateGhost(communicator,

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.