Skip to content

Commit

Permalink
Fixed serialization of IAtom's with null formal charge to not cause N…
Browse files Browse the repository at this point in the history
…ullPointerExceptions

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Jun 5, 2009
1 parent df57aea commit acc8012
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/org/openscience/cdk/io/MDLWriter.java
Expand Up @@ -310,8 +310,8 @@ public void writeMolecule(IAtomContainer container) throws Exception {
// write formal atomic charges
for (int i = 0; i < container.getAtomCount(); i++) {
IAtom atom = container.getAtom(i);
int charge = atom.getFormalCharge();
if (charge != 0) {
Integer charge = atom.getFormalCharge();
if (charge != null && charge != 0) {
writer.write("M CHG 1 ");
writer.write(formatMDLInt(i+1,3));
writer.write(" ");
Expand Down

0 comments on commit acc8012

Please sign in to comment.