From: Reza Rastak Date: Tue, 30 Jul 2019 01:42:00 +0000 (-0700) Subject: Bug in CellDataStorage::erase() fixed X-Git-Tag: v9.2.0-rc1~1341^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8433%2Fhead;p=dealii.git Bug in CellDataStorage::erase() fixed --- diff --git a/include/deal.II/base/quadrature_point_data.h b/include/deal.II/base/quadrature_point_data.h index f0a08bd99b..154ce61bf0 100644 --- a/include/deal.II/base/quadrature_point_data.h +++ b/include/deal.II/base/quadrature_point_data.h @@ -559,6 +559,8 @@ bool CellDataStorage::erase(const CellIteratorType &cell) { const auto it = map.find(cell); + if (it == map.end()) + return false; for (unsigned int i = 0; i < it->second.size(); i++) { Assert( diff --git a/tests/base/cell_data_storage_02.cc b/tests/base/cell_data_storage_02.cc index b01f6b376f..422ddbcc87 100644 --- a/tests/base/cell_data_storage_02.cc +++ b/tests/base/cell_data_storage_02.cc @@ -102,6 +102,10 @@ test() fe_values.reinit(dof_cell); const std::vector> &q_points = fe_values.get_quadrature_points(); + // before initialization, you can erase it without any consequences + const bool erased_nonexisting_data = data_storage.erase(cell); + Assert(!erased_nonexisting_data, ExcInternalError()); + // initialize data_storage.initialize(cell, rhs.size()); { std::vector> qpd =