]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Don't access an element of an array if the array has size zero.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 4 Jul 2011 20:38:13 +0000 (20:38 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 4 Jul 2011 20:38:13 +0000 (20:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@23918 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/base/index_set.cc

index 3693c121a91d45c3f4a7756494ba380affbde7a0..06f89ddb20704323495c33ec144283746b41efa0 100644 (file)
@@ -394,11 +394,13 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator,
       std::vector<unsigned int> indices;
       fill_index_vector(indices);
 
-      int * indices_ptr = reinterpret_cast<int*>(&indices[0]);
-
       return Epetra_Map (-1,
                         n_elements(),
-                        indices_ptr,
+                        (n_elements() > 0
+                         ?
+                         reinterpret_cast<int*>(&indices[0])
+                         :
+                         0),
                         0,
 #ifdef DEAL_II_COMPILER_SUPPORTS_MPI
                         Epetra_MpiComm(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.