diff --git a/src/mesh.cpp b/src/mesh.cpp index 866d12a28..4f85c58c8 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -1630,15 +1630,15 @@ void MOABMesh::create_interface() { // Do not create a MOAB instance if one is already in memory - if (!mbi_) { - // create MOAB instance - mbi_ = std::make_shared(); + if (mbi_) return; - // load unstructured mesh file - moab::ErrorCode rval = mbi_->load_file(filename_.c_str()); - if (rval != moab::MB_SUCCESS) { - fatal_error("Failed to load the unstructured mesh file: " + filename_); - } + // create MOAB instance + mbi_ = std::make_shared(); + + // load unstructured mesh file + moab::ErrorCode rval = mbi_->load_file(filename_.c_str()); + if (rval != moab::MB_SUCCESS) { + fatal_error("Failed to load the unstructured mesh file: " + filename_); } }