From: bangerth Date: Mon, 4 Jul 2011 20:38:13 +0000 (+0000) Subject: Don't access an element of an array if the array has size zero. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=506d22f01c538159df3f451120badd915c73a002;p=dealii-svn.git Don't access an element of an array if the array has size zero. git-svn-id: https://svn.dealii.org/trunk@23918 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/base/index_set.cc b/deal.II/source/base/index_set.cc index 3693c121a9..06f89ddb20 100644 --- a/deal.II/source/base/index_set.cc +++ b/deal.II/source/base/index_set.cc @@ -394,11 +394,13 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator, std::vector indices; fill_index_vector(indices); - int * indices_ptr = reinterpret_cast(&indices[0]); - return Epetra_Map (-1, n_elements(), - indices_ptr, + (n_elements() > 0 + ? + reinterpret_cast(&indices[0]) + : + 0), 0, #ifdef DEAL_II_COMPILER_SUPPORTS_MPI Epetra_MpiComm(communicator));