]> https://gitweb.dealii.org/ - dealii.git/commitdiff
avoid a segmentation fault
authorMatthias Maier <tamiko@43-1.org>
Mon, 22 Apr 2019 19:18:45 +0000 (14:18 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 23 Apr 2019 01:34:42 +0000 (20:34 -0500)
source/lac/dynamic_sparsity_pattern.cc

index cb93d1a37d085d8dd2f2871af0b1cf95707f8b90..b96163570f1b05ddffa150749cea3f9e35cafb40 100644 (file)
@@ -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;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.