Skip to content

Commit

Permalink
Fix autocomplete error from pegless material addition
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuan-Zheng05 committed Aug 30, 2024
1 parent d99f7c6 commit 88fda0d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions HEN_HOUSE/egs++/egs_input_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ vector<shared_ptr<EGS_SingleInput>> EGS_BlockInput::getSingleInputs() {
}

vector<shared_ptr<EGS_SingleInput>> EGS_BlockInput::getSingleInputs(string title) {
if (egsEquivStr(blockTitle, title) || (egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) ||
if (egsEquivStr(blockTitle, title) || (parent != nullptr && egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) ||
// Handle the special case where "target shape" and "source shape" for egs_collimated_source need to match just "shape".
(egsEquivStr(blockTitle, "shape") && (egsEquivStr(title, "target shape") || egsEquivStr(title, "source shape")))) {
return singleInputs;
Expand All @@ -222,7 +222,7 @@ vector<shared_ptr<EGS_BlockInput>> EGS_BlockInput::getBlockInputs() {
}

vector<shared_ptr<EGS_BlockInput>> EGS_BlockInput::getBlockInputs(string title) {
if (egsEquivStr(blockTitle, title) || (egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) ||
if (egsEquivStr(blockTitle, title) || (parent != nullptr && egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) ||
// Handle the special case where "target shape" and "source shape" for egs_collimated_source need to match just "shape".
(egsEquivStr(blockTitle, "shape") && (egsEquivStr(title, "target shape") || egsEquivStr(title, "source shape")))) {
return blockInputs;
Expand Down Expand Up @@ -259,7 +259,7 @@ shared_ptr<EGS_SingleInput> EGS_BlockInput::getSingleInput(string inputTag) {

shared_ptr<EGS_SingleInput> EGS_BlockInput::getSingleInput(string inputTag, string title) {
// First search the top-level input block
if (egsEquivStr(blockTitle, title) || (egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) ||
if (egsEquivStr(blockTitle, title) || (parent != nullptr && egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) ||
// Handle the special case where "target shape" and "source shape" for egs_collimated_source need to match just "shape".
(egsEquivStr(blockTitle, "shape") && (egsEquivStr(title, "target shape") || egsEquivStr(title, "source shape")))) {
for (auto &inp: singleInputs) {
Expand Down Expand Up @@ -306,9 +306,11 @@ shared_ptr<EGS_BlockInput> EGS_BlockInput::getBlockInput(string title) {
}
}

if(egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) {
return shared_from_this();
if(parent != nullptr && egsEquivStr(parent->getTitle(), "media definition") && egsEquivStr(blockTitle, "pegsless")) {
return shared_from_this();

}


return nullptr;
}
Expand Down

0 comments on commit 88fda0d

Please sign in to comment.