summaryrefslogtreecommitdiffstats
path: root/src/gradient-chemistry.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/gradient-chemistry.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/gradient-chemistry.cpp')
-rw-r--r--src/gradient-chemistry.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index a0da1e430..6983849fa 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -77,10 +77,12 @@ SPGradient *sp_gradient_ensure_vector_normalized(SPGradient *gr)
}
/* If gr hrefs some other gradient, remove the href */
- if (gr->ref->getObject()) {
- // We are hrefing someone, so require flattening
- gr->updateRepr(SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL);
- sp_gradient_repr_set_link(gr->getRepr(), NULL);
+ if (gr->ref){
+ if (gr->ref->getObject()) {
+ // We are hrefing someone, so require flattening
+ gr->updateRepr(SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL);
+ sp_gradient_repr_set_link(gr->getRepr(), NULL);
+ }
}
/* Everything is OK, set state flag */