summaryrefslogtreecommitdiffstats
path: root/src/desktop.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-04-28 19:54:06 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-04-28 19:54:06 +0000
commite844cf34c031c88490575db9bf781e5d9f2f23d3 (patch)
tree3479a543b898fb973a871ed8ef0637d6b8628229 /src/desktop.cpp
parentImproving Lead pencil again, cleaning and adding more controls (diff)
downloadinkscape-e844cf34c031c88490575db9bf781e5d9f2f23d3.tar.gz
inkscape-e844cf34c031c88490575db9bf781e5d9f2f23d3.zip
Fix crash reported in bug #311737
(bzr r7792)
Diffstat (limited to 'src/desktop.cpp')
-rw-r--r--src/desktop.cpp92
1 files changed, 47 insertions, 45 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 1f2baccbb..6b7c20094 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -886,51 +886,53 @@ SPDesktop::zoom_quick (bool enable)
Inkscape::NodePath::Path * nodepath = event_context->shape_editor->get_nodepath();
// printf("I've got a nodepath, crazy\n");
- Geom::Rect nodes;
- bool firstnode = true;
-
- if (nodepath->selected) {
- for (GList *spl = nodepath->subpaths; spl != NULL; spl = spl->next) {
- Inkscape::NodePath::SubPath *subpath = (Inkscape::NodePath::SubPath *) spl->data;
- for (GList *nl = subpath->nodes; nl != NULL; nl = nl->next) {
- Inkscape::NodePath::Node *node = (Inkscape::NodePath::Node *) nl->data;
- if (node->selected) {
- // printf("\tSelected node\n");
- if (firstnode) {
- nodes = Geom::Rect(node->pos, node->pos);
- firstnode = false;
- } else {
- nodes.expandTo(node->pos);
- }
-
- if (node->p.other != NULL) {
- /* Include previous node pos */
- nodes.expandTo(node->p.other->pos);
-
- /* Include previous handle */
- if (!sp_node_side_is_line(node, &node->p)) {
- nodes.expandTo(node->p.pos);
- }
- }
-
- if (node->n.other != NULL) {
- /* Include previous node pos */
- nodes.expandTo(node->n.other->pos);
-
- /* Include previous handle */
- if (!sp_node_side_is_line(node, &node->n)) {
- nodes.expandTo(node->n.pos);
- }
- }
- }
- }
- }
-
- if (!firstnode && nodes.area() * 2.0 < _quick_zoom_stored_area.area()) {
- set_display_area(nodes, 10);
- zoomed = true;
- }
- }
+ if (nodepath) {
+ Geom::Rect nodes;
+ bool firstnode = true;
+
+ if (nodepath->selected) {
+ for (GList *spl = nodepath->subpaths; spl != NULL; spl = spl->next) {
+ Inkscape::NodePath::SubPath *subpath = (Inkscape::NodePath::SubPath *) spl->data;
+ for (GList *nl = subpath->nodes; nl != NULL; nl = nl->next) {
+ Inkscape::NodePath::Node *node = (Inkscape::NodePath::Node *) nl->data;
+ if (node->selected) {
+ // printf("\tSelected node\n");
+ if (firstnode) {
+ nodes = Geom::Rect(node->pos, node->pos);
+ firstnode = false;
+ } else {
+ nodes.expandTo(node->pos);
+ }
+
+ if (node->p.other != NULL) {
+ /* Include previous node pos */
+ nodes.expandTo(node->p.other->pos);
+
+ /* Include previous handle */
+ if (!sp_node_side_is_line(node, &node->p)) {
+ nodes.expandTo(node->p.pos);
+ }
+ }
+
+ if (node->n.other != NULL) {
+ /* Include previous node pos */
+ nodes.expandTo(node->n.other->pos);
+
+ /* Include previous handle */
+ if (!sp_node_side_is_line(node, &node->n)) {
+ nodes.expandTo(node->n.pos);
+ }
+ }
+ }
+ }
+ }
+
+ if (!firstnode && nodes.area() * 2.0 < _quick_zoom_stored_area.area()) {
+ set_display_area(nodes, 10);
+ zoomed = true;
+ }
+ }
+ }
}
}