Skip to content

Commit 87a2c08

Browse files
committed
Cleaner calling, we should not add an isotope if the count is 0.
1 parent 6154028 commit 87a2c08

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

base/data/src/main/java/org/openscience/cdk/formula/MolecularFormula.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ public IMolecularFormula addIsotope(IIsotope isotope) {
113113
*/
114114
@Override
115115
public IMolecularFormula addIsotope(IIsotope isotope, int count) {
116+
if (count == 0)
117+
return this;
116118
boolean flag = false;
117119
for (IIsotope thisIsotope : isotopes()) {
118120
if (isTheSame(thisIsotope, isotope)) {

base/silent/src/main/java/org/openscience/cdk/silent/MolecularFormula.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public IMolecularFormula addIsotope(IIsotope isotope) {
110110
*/
111111
@Override
112112
public IMolecularFormula addIsotope(IIsotope isotope, int count) {
113+
if (count == 0)
114+
return this;
113115
boolean flag = false;
114116
for (IIsotope thisIsotope : isotopes()) {
115117
if (isTheSame(thisIsotope, isotope)) {

0 commit comments

Comments
 (0)