Skip to content
Snippets Groups Projects
Commit a2eb0de9 authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Fix crash when saving peaks workspace.

If for some reason one of the radii is not defined SaveNexus crashes
because we access the value without checking it first. We should just
check that both radii are present, then write them out.

(cherry picked from commit 5e7dc01597680694128a3897d2244238f17e145a)
parent d38d5762
No related branches found
No related tags found
No related merge requests found
...@@ -53,13 +53,10 @@ std::string PeakShapeSpherical::toJSON() const { ...@@ -53,13 +53,10 @@ std::string PeakShapeSpherical::toJSON() const {
Json::Value root; Json::Value root;
PeakShapeBase::buildCommon(root); PeakShapeBase::buildCommon(root);
root["radius"] = Json::Value(m_radius); root["radius"] = Json::Value(m_radius);
// Check that there is an inner radius before writing
if (m_backgroundInnerRadius.is_initialized()) { if (m_backgroundInnerRadius && m_backgroundOuterRadius) {
root["background_outer_radius"] = root["background_outer_radius"] =
Json::Value(m_backgroundOuterRadius.get()); Json::Value(m_backgroundOuterRadius.get());
}
// Check that there is an outer radius before writing
if (m_backgroundOuterRadius.is_initialized()) {
root["background_inner_radius"] = root["background_inner_radius"] =
Json::Value(m_backgroundInnerRadius.get()); Json::Value(m_backgroundInnerRadius.get());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment