From 4aabf2a995bdba7a42110f4292cb0e194722e429 Mon Sep 17 00:00:00 2001 From: bryce Date: Sun, 31 Dec 2006 22:50:51 +0000 Subject: [PATCH] Bugfix for 1625278, where inkscape would crash if loading a recent document from a fresh inkscape instance, that triggers a null pointer situation in sp-namedview. The code in question deals with gridviews, so I suspect it has something to do with grid settings. In any case, this commit prevents the null pointer situation and stops the crash. --- src/sp-namedview.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index a85577826..d3792133b 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -768,7 +768,12 @@ void SPNamedView::hide(SPDesktop const *desktop) GSList *l; for (l = gridviews; l != NULL; l = l->next) { - if (SP_CANVAS_ITEM(l->data)->canvas == sp_desktop_canvas(desktop)) { + if (! l->data) { + continue; + } + SPCanvasItem *item = static_cast(l->data); + + if (item->canvas == sp_desktop_canvas(desktop)) { sp_canvas_item_hide(SP_CANVAS_ITEM(l->data)); gtk_object_unref(GTK_OBJECT(l->data)); gridviews = g_slist_remove(gridviews, l->data); -- 2.39.5