fixed a nullpointer during copy and paste

This commit is contained in:
hneemann 2017-03-13 14:26:57 +01:00
parent f83d26dc31
commit 7877c2de4f

View File

@ -77,6 +77,9 @@ public class CircuitTransferable implements Transferable {
Vector max = null; Vector max = null;
try (Reader in = new StringReader(data.toString())) { try (Reader in = new StringReader(data.toString())) {
ArrayList<Moveable> elements = (ArrayList<Moveable>) xStream.fromXML(in); ArrayList<Moveable> elements = (ArrayList<Moveable>) xStream.fromXML(in);
if (elements == null)
return null;
for (Moveable m : elements) for (Moveable m : elements)
if (m instanceof VisualElement) { if (m instanceof VisualElement) {
((VisualElement) m).setShapeFactory(shapeFactory); ((VisualElement) m).setShapeFactory(shapeFactory);