From: Jim Procter Date: Thu, 20 Oct 2022 15:45:16 +0000 (+0100) Subject: JAL-2349 avoid div-by-zero when annotation height is zero (though poss better to... X-Git-Tag: Release_2_11_3_0~23^2~26 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=ec1ed55ce0f333f55d400ee5f25b88454a7fe0ba JAL-2349 avoid div-by-zero when annotation height is zero (though poss better to simply avoid rendering contact at all) --- diff --git a/src/jalview/renderer/ContactGeometry.java b/src/jalview/renderer/ContactGeometry.java index 0e5107a..52581fb 100644 --- a/src/jalview/renderer/ContactGeometry.java +++ b/src/jalview/renderer/ContactGeometry.java @@ -16,7 +16,8 @@ public class ContactGeometry { contact_height = contacts.getContactHeight(); // fractional number of contacts covering each pixel - contacts_per_pixel = ((double) contact_height) / ((double) graphHeight); + contacts_per_pixel = (graphHeight < 1) ? contact_height + : ((double) contact_height) / ((double) graphHeight); if (contacts_per_pixel >= 1) {