Skip to content

Commit

Permalink
fixed negative functional group count bug in Shorthand2020 and Goslin…
Browse files Browse the repository at this point in the history
… grammar
  • Loading branch information
dominik-kopczynski committed Apr 11, 2022
1 parent 777045e commit 9cc1da0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser/GoslinParserEventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ void GoslinParserEventHandler::add_carbon(TreeNode *node) {

void GoslinParserEventHandler::add_hydroxyl(TreeNode *node) {
int num_h = atoi(node->get_text().c_str());

if (sp_regular_lcb()) num_h -= 1;
if (num_h <= 0) return;

FunctionalGroup* functional_group = KnownFunctionalGroups::get_functional_group("OH");
functional_group->count = num_h;
Expand Down
4 changes: 4 additions & 0 deletions src/parser/ShorthandParserEventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,10 @@ void ShorthandParserEventHandler::add_functional_group(TreeNode *node){
set_lipid_level(STRUCTURE_DEFINED);
}

if (fg_cnt <= 0){
return;
}

FunctionalGroup *functional_group = 0;
try {
functional_group = KnownFunctionalGroups::get_functional_group(fg_name);
Expand Down

0 comments on commit 9cc1da0

Please sign in to comment.