Code

Filter effects dialog:
[inkscape.git] / src / guide-snapper.cpp
index fbf1af0af1bd61c38e64177b90bfcd32cd1759ea..1e4eb02d835e49541de517e29900d7198587f292 100644 (file)
@@ -26,6 +26,10 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point
 {
     LineList s;
 
+    if ( NULL == _named_view || ThisSnapperMightSnap() == false) {
+        return s;
+    }
+
     for (GSList const *l = _named_view->guides; l != NULL; l = l->next) {
         SPGuide const *g = SP_GUIDE(l->data);
 
@@ -40,6 +44,14 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point
     return s;
 }
 
+/**
+ *  \return true if this Snapper will snap at least one kind of point.
+ */
+bool Inkscape::GuideSnapper::ThisSnapperMightSnap() const
+{
+    return _named_view == NULL ? false : (_enabled && _snap_to != 0 && _named_view->showguides);
+}
+
 /*
   Local Variables:
   mode:c++