Skip to content

Commit

Permalink
Fix undefined behaviour from unthrown error
Browse files Browse the repository at this point in the history
  • Loading branch information
ndevenish committed Aug 15, 2023
1 parent 8078741 commit f796e4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/XXX.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix situation where a bad ``Beam.probe`` could cause undefined behaviour.
4 changes: 2 additions & 2 deletions src/dxtbx/model/beam.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ namespace dxtbx { namespace model {
case neutron:
return std::string("neutron");
default:
DXTBX_ERROR("Unknown probe type");
throw DXTBX_ERROR("Unknown probe type");
}
}

Expand All @@ -335,7 +335,7 @@ namespace dxtbx { namespace model {
return Probe::neutron;
}

DXTBX_ERROR("Unknown probe " + probe);
throw DXTBX_ERROR("Unknown probe " + probe);
}

void set_probe(Probe probe) {
Expand Down

0 comments on commit f796e4d

Please sign in to comment.