Skip to content

Commit

Permalink
Deal with null charges on 'this' too
Browse files Browse the repository at this point in the history
Change-Id: I94f5cea8fef424c597bd00390f056d87782a2247
  • Loading branch information
egonw committed Sep 16, 2014
1 parent a988852 commit 5f444a1
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -88,7 +88,11 @@ public IMolecularFormula add(IMolecularFormula formula) {
for (IIsotope newIsotope : formula.isotopes()) {
addIsotope(newIsotope, formula.getIsotopeCount(newIsotope));
}
if (formula.getCharge() != null) charge += formula.getCharge();
if (formula.getCharge() != null)
if (charge != null)
charge += formula.getCharge();
else
charge = formula.getCharge();
return this;
}

Expand Down

0 comments on commit 5f444a1

Please sign in to comment.