Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added null check to avoid NPE when no model is present

  • Loading branch information...
commit 185f6f1069aba753e2932c1e93d7bf8dfd127566 1 parent 023fde0
Arvid Berg authored egonw committed
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/main/org/openscience/cdk/renderer/Renderer.java
View
3  src/main/org/openscience/cdk/renderer/Renderer.java
@@ -149,7 +149,8 @@ public Renderer(List<IGenerator<IAtomContainer>> generators,
public void setup(IChemModel chemModel, Rectangle screen) {
this.setScale(chemModel);
Rectangle2D bounds = Renderer.calculateBounds(chemModel);
- this.modelCenter = new Point2d(bounds.getCenterX(), bounds.getCenterY());
+ if(bounds != null)
+ this.modelCenter = new Point2d(bounds.getCenterX(), bounds.getCenterY());
this.drawCenter = new Point2d(screen.getCenterX(), screen.getCenterY());
this.setup();
}
Please sign in to comment.
Something went wrong with that request. Please try again.