From bbec475626c85e18d0eef62711451a6deaa95931 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 7 Jul 2011 14:50:22 +0000 Subject: [PATCH] Do not access the first element if the vector is empty. git-svn-id: https://svn.dealii.org/trunk@23928 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/lac/petsc_parallel_vector.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deal.II/source/lac/petsc_parallel_vector.cc b/deal.II/source/lac/petsc_parallel_vector.cc index f2737d80b1..7a8968acf3 100644 --- a/deal.II/source/lac/petsc_parallel_vector.cc +++ b/deal.II/source/lac/petsc_parallel_vector.cc @@ -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 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, -- 2.39.5