diff src/DLD-FUNCTIONS/fltk_backend.cc @ 10593:26d51c6e1c4c

fixed fltk_backend bug when clicking on empty figure
author Shai Ayal <shaiay@users.sourceforge.net>
date Sat, 01 May 2010 00:05:46 +0300 (2010-04-30)
parents a80207303549
children 91342260063e
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/fltk_backend.cc
+++ b/src/DLD-FUNCTIONS/fltk_backend.cc
@@ -464,19 +464,22 @@
 
   void set_axes_currentpoint (graphics_object ax, int px, int py)
   {
-    axes::properties& ap = 
-      dynamic_cast<axes::properties&> (ax.get_properties ());
+    if (ax)
+      {
+        axes::properties& ap = 
+          dynamic_cast<axes::properties&> (ax.get_properties ());
     
-    double xx, yy;
-    pixel2pos (ax, px, py, xx, yy);
+        double xx, yy;
+        pixel2pos (ax, px, py, xx, yy);
 
-    Matrix pos (2,3,0);
-    pos(0,0) = xx;
-    pos(1,0) = yy;
-    pos(0,1) = xx;
-    pos(1,1) = yy;
+        Matrix pos (2,3,0);
+        pos(0,0) = xx;
+        pos(1,0) = yy;
+        pos(0,1) = xx;
+        pos(1,1) = yy;
 
-    ap.set_currentpoint (pos);
+        ap.set_currentpoint (pos);
+      }
   }
 
   int key2shift (int key)