From: Reza Rastak Date: Tue, 6 Aug 2019 20:58:58 +0000 (-0600) Subject: Null pointer check added to CellDagaStorage::get_data() X-Git-Tag: v9.2.0-rc1~1309^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3adc3cf27de33d7657ab40fffc46738e71d96eb;p=dealii.git Null pointer check added to CellDagaStorage::get_data() --- diff --git a/include/deal.II/base/quadrature_point_data.h b/include/deal.II/base/quadrature_point_data.h index 154ce61bf0..8656eac401 100644 --- a/include/deal.II/base/quadrature_point_data.h +++ b/include/deal.II/base/quadrature_point_data.h @@ -163,6 +163,13 @@ private: * A map to store a vector of data on a cell. */ std::map>> map; + + /** + * @addtogroup Exceptions + */ + DeclExceptionMsg( + ExcCellDataTypeMismatch, + "Cell data is being retrieved with a type which is different than the type used to initialize it"); }; @@ -617,7 +624,10 @@ CellDataStorage::get_data( // the T==DataType: std::vector> res(it->second.size()); for (unsigned int q = 0; q < res.size(); q++) - res[q] = std::dynamic_pointer_cast(it->second[q]); + { + res[q] = std::dynamic_pointer_cast(it->second[q]); + Assert(res[q], ExcCellDataTypeMismatch()); + } return res; } @@ -640,7 +650,10 @@ CellDataStorage::get_data( // does not modify the content of QP objects std::vector> res(it->second.size()); for (unsigned int q = 0; q < res.size(); q++) - res[q] = std::dynamic_pointer_cast(it->second[q]); + { + res[q] = std::dynamic_pointer_cast(it->second[q]); + Assert(res[q], ExcCellDataTypeMismatch()); + } return res; }