Skip to content
Browse files

Check null hydrogen count [bug:1335]

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information...
1 parent 2f7e936 commit 536111bec25d19ab030b455e4eb0047513c2d13e @johnmay johnmay committed with egonw Mar 28, 2014
Showing with 4 additions and 1 deletion.
  1. +4 −1 misc/extra/src/main/java/org/openscience/cdk/validate/BasicValidator.java
View
5 misc/extra/src/main/java/org/openscience/cdk/validate/BasicValidator.java
@@ -159,7 +159,10 @@ private ValidationReport validateHydrogenCount(IAtom atom) {
ValidationTest negativeHydrogenCount = new ValidationTest(atom,
"An Atom cannot have a negative number of hydrogens attached."
);
- if (atom.getImplicitHydrogenCount() < 0 ) {
+ if (atom.getImplicitHydrogenCount() == null) {
+ report.addWarning(new ValidationTest(atom, "An atom had unset (null) implicit hydrogen count"));
+ }
+ else if (atom.getImplicitHydrogenCount() < 0 ) {
negativeHydrogenCount.setDetails(
"Atom has " + atom.getImplicitHydrogenCount() + " hydrogens."
);

0 comments on commit 536111b

Please sign in to comment.
Something went wrong with that request. Please try again.