]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add assert on range of incoming index in Tensor::operator[] const. 10452/head
authorSimon Sticko <simon@sticko.se>
Wed, 3 Jun 2020 14:41:04 +0000 (16:41 +0200)
committerSimon Sticko <simon@sticko.se>
Wed, 3 Jun 2020 14:43:15 +0000 (16:43 +0200)
include/deal.II/base/tensor.h

index a18260c869492258fb34f62026d2970b82f4c023..69b5ce9035d6210f124b76e21a6fd49013b3211a 100644 (file)
@@ -1253,6 +1253,8 @@ constexpr DEAL_II_ALWAYS_INLINE
     DEAL_II_CUDA_HOST_DEV const typename Tensor<rank_, dim, Number>::value_type &
     Tensor<rank_, dim, Number>::operator[](const unsigned int i) const
 {
+  AssertIndexRange(i, dim);
+
   return values[i];
 }
 

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.