Skip to content

Commit 8008c68

Browse files
committed
Null check mass number in CIP rule
1 parent 04f4d16 commit 8008c68

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/rules/MassNumberRule.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.openscience.cdk.config.Isotopes;
2929
import org.openscience.cdk.config.IsotopeFactory;
3030
import org.openscience.cdk.geometry.cip.ILigand;
31+
import org.openscience.cdk.interfaces.IIsotope;
3132
import org.openscience.cdk.tools.ILoggingTool;
3233
import org.openscience.cdk.tools.LoggingToolFactory;
3334

@@ -63,7 +64,9 @@ private Integer getMassNumber(ILigand ligand) {
6364
Integer massNumber = ligand.getLigandAtom().getMassNumber();
6465
if (massNumber != null) return massNumber;
6566
if (factory == null) return 0;
66-
return factory.getMajorIsotope(ligand.getLigandAtom().getSymbol()).getMassNumber();
67+
IIsotope isotope = factory.getMajorIsotope(ligand.getLigandAtom().getSymbol());
68+
if (isotope == null) return 0;
69+
return isotope.getMassNumber();
6770
}
6871

6972
}

0 commit comments

Comments
 (0)