From: David Wells <wellsd2@rpi.edu>
Date: Thu, 17 May 2018 22:00:42 +0000 (-0400)
Subject: Exit a function early if there are no DoFs.
X-Git-Tag: v9.1.0-rc1~1132^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37ed3c48b6de584fc945f528b93f42268671e987;p=dealii.git

Exit a function early if there are no DoFs.

The debug mode of glibc complains that, with FE_Nothing, we end up doing
an invalid array access below. Avoid that by returning early if there is
nothing to do anyway.
---

diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h
index 0ce19502a8..b584743738 100644
--- a/include/deal.II/dofs/dof_accessor.templates.h
+++ b/include/deal.II/dofs/dof_accessor.templates.h
@@ -2832,11 +2832,12 @@ namespace internal
       void
       update_cell_dof_indices_cache (const DoFCellAccessor<dealii::hp::DoFHandler<dim,spacedim>, level_dof_access> &accessor)
       {
-        // caches are only for cells with DoFs, i.e., for active ones
+        // caches are only for cells with DoFs, i.e., for active ones and not FE_Nothing
         if (accessor.has_children())
           return;
-
         const unsigned int dofs_per_cell = accessor.get_fe().dofs_per_cell;
+        if (dofs_per_cell == 0)
+          return;
 
         // make sure the cache is at least
         // as big as we need it when