fixed a bug in the splitter, which ocures if definition is invalid

This commit is contained in:
hneemann 2018-02-27 12:23:08 +01:00
parent a2b554ddc5
commit 4b54430a17
2 changed files with 6 additions and 3 deletions

View File

@ -272,8 +272,11 @@ public class Splitter implements Element {
if (pos >= 0) {
int from = Integer.decode(strVal.substring(0, pos).trim());
int to = Integer.decode(strVal.substring(pos + 1).trim());
if (to < from)
throw new BitsException(Lang.get("err_spitterDefSyntaxError", definition));
if (to < from) {
int z = to;
to = from;
from = z;
}
add(new Port(from, to - from + 1));
} else
add(new Port(bits, Integer.decode(strVal)));

View File

@ -50,7 +50,7 @@ public class MissingShape implements Shape {
while (c != null) {
y += style.getFontSize();
String message = c.getMessage();
if (message.length() > 100)
if (message != null && message.length() > 100)
message = message.substring(0, 100) + "...";
graphic.drawText(new Vector(4, y), new Vector(5, y), message, Orientation.LEFTTOP, style);
c = c.getCause();