From ec1ed55ce0f333f55d400ee5f25b88454a7fe0ba Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 20 Oct 2022 16:45:16 +0100 Subject: [PATCH] JAL-2349 avoid div-by-zero when annotation height is zero (though poss better to simply avoid rendering contact at all) --- src/jalview/renderer/ContactGeometry.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- 1.7.10.2