summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-05-04 15:40:04 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-05-04 15:40:04 +0000
commitecdd31b0c95f8f210038bc3dd5dfc0afb7a68883 (patch)
tree56a4dbdc763833577eebb9571128ac8ee8649117 /src/sp-item.cpp
parentcpp-style casting (diff)
downloadinkscape-ecdd31b0c95f8f210038bc3dd5dfc0afb7a68883.tar.gz
inkscape-ecdd31b0c95f8f210038bc3dd5dfc0afb7a68883.zip
Adding checks to prevent null pointer dereferences
(bzr r11325)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index d6395cfee..e0a9b97f2 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -660,15 +660,19 @@ Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML
repr->setAttribute ("inkscape:transform-center-y", NULL);
}
- if (item->clip_ref->getObject()) {
- const gchar *value = g_strdup_printf ("url(%s)", item->clip_ref->getURI()->toString());
- repr->setAttribute ("clip-path", value);
- g_free ((void *) value);
- }
- if (item->mask_ref->getObject()) {
- const gchar *value = g_strdup_printf ("url(%s)", item->mask_ref->getURI()->toString());
- repr->setAttribute ("mask", value);
- g_free ((void *) value);
+ if (item->clip_ref){
+ if (item->clip_ref->getObject()) {
+ const gchar *value = g_strdup_printf ("url(%s)", item->clip_ref->getURI()->toString());
+ repr->setAttribute ("clip-path", value);
+ g_free ((void *) value);
+ }
+ }
+ if (item->mask_ref){
+ if (item->mask_ref->getObject()) {
+ const gchar *value = g_strdup_printf ("url(%s)", item->mask_ref->getURI()->toString());
+ repr->setAttribute ("mask", value);
+ g_free ((void *) value);
+ }
}
if (((SPObjectClass *) (SPItemClass::static_parent_class))->write) {