Skip to content

Commit

Permalink
Merge pull request #29 from andrsd/no-ent-fix
Browse files Browse the repository at this point in the history
Do not crash if there is no physical entity
  • Loading branch information
andrsd authored Oct 24, 2024
2 parents 69cc682 + 54f1b58 commit 0a94c28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,11 @@ build_element_blocks(const std::vector<const gmshparsercpp::MshFile::ElementBloc

unsigned int eid = 0;
for (const auto & eb : el_blks) {
const auto & ent = ents_by_id[eb->tag];
const auto * ent = ents_by_id[eb->tag];
int id;
if (!ent->physical_tags.empty()) {
if (ent == nullptr)
id = eb->tag;
else if (!ent->physical_tags.empty()) {
// the sign on physical tag ID refers to orientation which we don't need
id = std::abs(ent->physical_tags[0]);
auto it = phys_ent_by_tag.find(id);
Expand Down

0 comments on commit 0a94c28

Please sign in to comment.