From eeff6aa06c09d3335fc0dfc6fc354e918ab6cad1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 1 Oct 2022 13:34:55 -0400 Subject: [PATCH] make sure to always look up the region to avoid null pointer dereference --- src/compute_chunk_atom.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index ccd5da433f..013efb8c50 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -906,7 +906,11 @@ void ComputeChunkAtom::assign_chunk_ids() // update region if necessary - if (regionflag) region->prematch(); + if (regionflag) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for compute chunk/atom does not exist", idregion); + region->prematch(); + } // exclude = 1 if atom is not assigned to a chunk // exclude atoms not in group or not in optional region