Code

Whoops, put check on empty rect back in! Maybe no one noticed ;-)
authordvlierop2 <dvlierop2@users.sourceforge.net>
Tue, 28 Aug 2007 20:19:48 +0000 (20:19 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Tue, 28 Aug 2007 20:19:48 +0000 (20:19 +0000)
src/object-snapper.cpp

index 57937145a6e75a2b8bee753b474abfde71c16595..785f80960800089d13775404a4a3648ebc6fc4e3 100644 (file)
@@ -62,17 +62,18 @@ void Inkscape::ObjectSnapper::_findCandidates(std::list<SPItem*>& c,
                         _findCandidates(c, o, it, p, snap_dim);
                     } else {
                         NR::Maybe<NR::Rect> b = sp_item_bbox_desktop(SP_ITEM(o));
-                        NR::Point b_min = b->min();
-                        NR::Point b_max = b->max();
-                        double d = getDistance();
-                        bool withinX = (p[NR::X] >= b_min[NR::X] - d) && (p[NR::X] <= b_max[NR::X] + d); 
-                        bool withinY = (p[NR::Y] >= b_min[NR::Y] - d) && (p[NR::Y] <= b_max[NR::Y] + d);
-                        if (snap_dim == SNAP_X && withinX || snap_dim == SNAP_Y && withinY || snap_dim == SNAP_XY && withinX && withinY) {
-                            c.push_back(SP_ITEM(o));
+                        if (b) {
+                               NR::Point b_min = b->min();
+                               NR::Point b_max = b->max();
+                               double d = getDistance();
+                               bool withinX = (p[NR::X] >= b_min[NR::X] - d) && (p[NR::X] <= b_max[NR::X] + d); 
+                               bool withinY = (p[NR::Y] >= b_min[NR::Y] - d) && (p[NR::Y] <= b_max[NR::Y] + d);
+                               if (snap_dim == SNAP_X && withinX || snap_dim == SNAP_Y && withinY || snap_dim == SNAP_XY && withinX && withinY) {
+                                   c.push_back(SP_ITEM(o));
+                               }
                         }
                     }
-                }
-    
+                }    
             }
         }
     }