Skip to content

Commit

Permalink
Only set electron valency if the pi bond count and formal neighbour c…
Browse files Browse the repository at this point in the history
…ount are set.
  • Loading branch information
johnmay committed Nov 28, 2015
1 parent 195631e commit 565530e
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -75,7 +75,12 @@ final class ImmutableAtomType implements IAtomType {
if (type.getValency() != null) {
this.electronValency = type.getValency();
} else {
this.electronValency = type.getProperty(CDKConstants.PI_BOND_COUNT, Integer.class) + type.getFormalNeighbourCount();
Integer piBondCount = type.getProperty(CDKConstants.PI_BOND_COUNT, Integer.class);
if (piBondCount != null && formalNeighbourCount != null) {
this.electronValency = piBondCount + formalNeighbourCount;
} else {
this.electronValency = null;
}
}
}

Expand Down

0 comments on commit 565530e

Please sign in to comment.