fixes a NullPointerException

This commit is contained in:
hneemann 2021-03-13 17:30:42 +01:00
parent bc0e7a87e0
commit f6f457ffa4

View File

@ -1542,6 +1542,8 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
}
private boolean wasMoved(MouseEvent e) {
if (pos == null) // seems to happen in very rare cases
return false;
Vector d = new Vector(e.getX(), e.getY()).sub(pos);
return Math.abs(d.x) > DRAG_DISTANCE || Math.abs(d.y) > DRAG_DISTANCE;
}