From 71ec74823894138693ed9cde9e22270453fb4127 Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Wed, 16 Aug 2017 12:49:09 +0300 Subject: [PATCH] renderSVG hardening refs #7421 Change-Id: I307f298d8c7c6adfa2627634c3f4d0a6db3e2afb --- .../org/simantics/modeling/SCLScenegraph.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java index 5f375095f..3e81b1c5c 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java @@ -632,11 +632,15 @@ public class SCLScenegraph { double trX = -1 * content.getX(); double trY = -1 * content.getY(); + // NaNs + if(!Double.isFinite(trX)) trX = 0; + if(!Double.isFinite(trY)) trY = 0; + result.append(MAIN_SECTION, ""); + result.append(MAIN_SECTION, ")\">"); result.append(SELECTION_SECTION, ""); @@ -785,10 +789,13 @@ public class SCLScenegraph { parentBuilder2.append(SELECTION_SECTION, "\n"); parentBuilder2.append(SELECTION_MASK_SECTION, "\n"); Rectangle2D rect = n.getRect(); - parentBuilder2.append(SELECTION_MASK_SECTION,""); + // NaN + if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) { + parentBuilder2.append(SELECTION_MASK_SECTION,""); + } parentBuilder2.append(SELECTION_MASK_SECTION,"\n"); } } else if (node instanceof SVGNode) { -- 2.47.1