Skip to content

Commit

Permalink
More springsalad issues detected, fixing NPE.
Browse files Browse the repository at this point in the history
  • Loading branch information
danv61 committed Aug 15, 2023
1 parent 9db0c04 commit c89bf2d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,14 @@ else if(!candidate.isForceContinuous() && !candidate.isConstant()) {
}
MolecularTypePattern mtp = mtpList.get(0);
List<MolecularComponentPattern> mcpList = mtp.getComponentPatternList();
if(SourceMoleculeString.equals(sc.getName()) || SinkMoleculeString.equals(sc.getName())) {
if(mcpList.size() != 0) {
String msg = "SpringSaLaD reserved Molecules '" + SourceMoleculeString + "' and '" + SinkMoleculeString + "' must not have any sites defined";
String tip = msg;
issueVector.add(new Issue(this, issueContext, IssueCategory.Identifiers, msg, tip, Issue.Severity.WARNING));
return;
}
}
if(mcpList.size() == 0) {
String msg = "SpringSaLaD requires the MolecularType to have at least one Site.";
String tip = msg;
Expand Down Expand Up @@ -1088,6 +1096,10 @@ else if(!candidate.isForceContinuous() && !candidate.isConstant()) {
if(sc == scCandidate) {
continue; // skip self
}
if(scCandidate.getSpeciesPattern() == null) {
// invalid, we'll deal with it separately - skip for now since will generate a NPE
continue;
}
MolecularType mtCandidate = scCandidate.getSpeciesPattern().getMolecularTypePatterns().get(0).getMolecularType();
if(mtp.getMolecularType() == mtCandidate) {
String msg = "There must be a biunivocal correspondence between the Species and the associated MolecularType.";
Expand Down

0 comments on commit c89bf2d

Please sign in to comment.