From d38af718f38d78bdc0819dc0571c23c56cbf7d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Thu, 8 Aug 2024 15:09:00 +0200 Subject: [PATCH] Fix SEGFAULT on missing mesh (#196) * Fix SEGFAULT on missing mesh * Add changelog --- changelog-entries/196.md | 1 + src/modes.cpp | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 changelog-entries/196.md diff --git a/changelog-entries/196.md b/changelog-entries/196.md new file mode 100644 index 00000000..164c3d00 --- /dev/null +++ b/changelog-entries/196.md @@ -0,0 +1 @@ +- Fixed SEGFAULT in `precice-aste-run` if no mesh is found for the given name. diff --git a/src/modes.cpp b/src/modes.cpp index 02f7608b..97973ac6 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -200,6 +200,11 @@ void aste::runMapperMode(const aste::ExecutionContext &context, const OptionMap } auto asteInterface = asteConfiguration.asteInterfaces.front(); + if (asteInterface.meshes.empty()) { + ASTE_ERROR << "ERROR: Could not find meshes for name: " << meshname; + MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE); + } + ASTE_INFO << "Loading mesh from " << asteInterface.meshes.front().filename(); const bool requireConnectivity = preciceInterface.requiresMeshConnectivityFor(asteInterface.meshName); const int dim = preciceInterface.getMeshDimensions(asteInterface.meshName);