From aae1a0580b896086c557856b9eafa6d5534d5351 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 22 Apr 2019 14:18:45 -0500 Subject: [PATCH] avoid a segmentation fault --- source/lac/dynamic_sparsity_pattern.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/lac/dynamic_sparsity_pattern.cc b/source/lac/dynamic_sparsity_pattern.cc index cb93d1a37d..b96163570f 100644 --- a/source/lac/dynamic_sparsity_pattern.cc +++ b/source/lac/dynamic_sparsity_pattern.cc @@ -360,6 +360,11 @@ DynamicSparsityPattern::exists(const size_type i, const size_type j) const Assert(j < cols, ExcIndexRange(j, 0, cols)); Assert(rowset.size() == 0 || rowset.is_element(i), ExcInternalError()); + // Avoid a segmentation fault in below code if the row index happens to + // not be present in the IndexSet rowset: + if (!(rowset.size() == 0 || rowset.is_element(i))) + return false; + if (!have_entries) return false; -- 2.39.5