From: Peter Munch Date: Sun, 6 Feb 2022 06:01:38 +0000 (+0100) Subject: Fix assert message for empty vector X-Git-Tag: v9.4.0-rc1~524^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6338473b056c03f4f7ce6162c5f086269d339efe;p=dealii.git Fix assert message for empty vector --- diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index 15988bdc09..a8be748565 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -1640,7 +1640,9 @@ namespace LinearAlgebra partitioner->ghost_indices().is_element(global_index), ExcAccessToNonLocalElement(global_index, partitioner->local_range().first, - partitioner->local_range().second - 1, + partitioner->local_range().second == 0 ? + 0 : + (partitioner->local_range().second - 1), partitioner->ghost_indices().n_elements())); // do not allow reading a vector which is not in ghost mode Assert(partitioner->in_local_range(global_index) || @@ -1664,7 +1666,9 @@ namespace LinearAlgebra partitioner->ghost_indices().is_element(global_index), ExcAccessToNonLocalElement(global_index, partitioner->local_range().first, - partitioner->local_range().second - 1, + partitioner->local_range().second == 0 ? + 0 : + (partitioner->local_range().second - 1), partitioner->ghost_indices().n_elements())); // we would like to prevent reading ghosts from a vector that does not // have them imported, but this is not possible because we might be in a