From 506d22f01c538159df3f451120badd915c73a002 Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 4 Jul 2011 20:38:13 +0000 Subject: [PATCH] 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 --- deal.II/source/base/index_set.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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)); -- 2.39.5