Revision: 3503
Author: [email protected]
Date: Thu May  6 09:26:31 2010
Log: NEW - bug 2794: NPE when using paste menu item
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2794

If the point to zoom is null then the point should be returned as null. This fixes the paste as it works when the pointer location is unknown.
http://code.google.com/p/power-architect/source/detail?r=3503

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java Fri Apr 30 15:31:53 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java Thu May 6 09:26:31 2010
@@ -1013,30 +1013,35 @@
        public void setScrollPane(Component ppScrollPane){
         this.ppScrollPane = ppScrollPane;
     }
-
-       /**
-        * Modifies the given point p in model space to apparent position
-        * in screen space.
-        *
-        * @param p The point in model space (the space where the actual
-        * components of the content pane live).  THIS PARAMETER IS MODIFIED.
-        * @return The given point p, which has been modified.
-        */
+
+    /**
+ * Modifies the given point p in model space to apparent position in screen
+     * space.
+     *
+     * @param p
+     *            The point in model space (the space where the actual
+     *            components of the content pane live). THIS PARAMETER IS
+     *            MODIFIED.
+ * @return The given point p, which has been modified or null if p was null.
+     */
        public Point zoomPoint(Point p) {
+           if (p == null) return null;
                p.x = (int) ((double) p.x * zoom);
                p.y = (int) ((double) p.y * zoom);
                return p;
        }

-       /**
-        * Modifies the given point p from apparent position in screen
-        * space to model space.
-        *
-        * @param p The point in visible screen space (the space where
-        * mouse events are reported).  THIS PARAMETER IS MODIFIED.
-        * @return The given point p, which has been modified.
-        */
+    /**
+     * Modifies the given point p from apparent position in screen space to
+     * model space.
+     *
+     * @param p
+     *            The point in visible screen space (the space where mouse
+     *            events are reported). THIS PARAMETER IS MODIFIED.
+ * @return The given point p, which has been modified or null if p was null.
+     */
        public Point unzoomPoint(Point p) {
+           if (p == null) return null;
                p.x = (int) ((double) p.x / zoom);
                p.y = (int) ((double) p.y / zoom);
                return p;

Reply via email to