From ef634b7eea60334e4ade70ba74e0ee1af3be6e35 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:49:49 +0100 Subject: [PATCH 1/3] Add null pointer case --- src/t8_forest/t8_forest.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/t8_forest/t8_forest.cxx b/src/t8_forest/t8_forest.cxx index f66522f471..24d5e43e39 100644 --- a/src/t8_forest/t8_forest.cxx +++ b/src/t8_forest/t8_forest.cxx @@ -1466,6 +1466,11 @@ t8_gloidx_t t8_forest_element_face_neighbor (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh, t8_eclass_t neigh_eclass, int face, int *neigh_face) { + int dummy = 0; + if (neigh_face == nullptr) { + neigh_face = &dummy; + } + /* Get a pointer to the tree to read its element class */ const t8_tree_t tree = t8_forest_get_tree (forest, ltreeid); const t8_eclass_t eclass = tree->eclass; From 0ac3bae33e7e9902ab9846131f1994d04a45b04f Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:57:02 +0100 Subject: [PATCH 2/3] Update documentation --- src/t8_forest/t8_forest_general.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_forest/t8_forest_general.h b/src/t8_forest/t8_forest_general.h index b57878b920..9301e3eb98 100644 --- a/src/t8_forest/t8_forest_general.h +++ b/src/t8_forest/t8_forest_general.h @@ -861,7 +861,7 @@ t8_forest_element_neighbor_eclass (t8_forest_t forest, t8_locidx_t ltreeid, cons * the data could be modified arbitrarily. * \param [in] neigh_eclass The eclass of \a neigh. * \param [in] face The number of the face along which the neighbor should be constructed. - * \param [out] neigh_face The number of the face viewed from perspective of \a neigh. + * \param [out] neigh_face The number of the face viewed from perspective of \a neigh. Can be nullptr. * \return The global tree-id of the tree in which \a neigh is in. * -1 if there exists no neighbor across that face. */ From e55d09e26f0a997480e040e3aaa3847f23bee450 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:59:12 +0100 Subject: [PATCH 3/3] indent --- src/t8_forest/t8_forest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_forest/t8_forest.cxx b/src/t8_forest/t8_forest.cxx index 24d5e43e39..51a29d1254 100644 --- a/src/t8_forest/t8_forest.cxx +++ b/src/t8_forest/t8_forest.cxx @@ -1470,7 +1470,7 @@ t8_forest_element_face_neighbor (t8_forest_t forest, t8_locidx_t ltreeid, const if (neigh_face == nullptr) { neigh_face = &dummy; } - + /* Get a pointer to the tree to read its element class */ const t8_tree_t tree = t8_forest_get_tree (forest, ltreeid); const t8_eclass_t eclass = tree->eclass;