summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 88e0b06)
raw | patch | inline | side by side (parent: 88e0b06)
author | cilix42 <cilix42@users.sourceforge.net> | |
Fri, 22 Feb 2008 10:18:37 +0000 (10:18 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Fri, 22 Feb 2008 10:18:37 +0000 (10:18 +0000) |
src/object-snapper.cpp | patch | blob | history | |
src/sp-use.cpp | patch | blob | history |
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index e320f013fe8e8f36451084046564465587a50f37..0308efe2d5e65e2b40907e8fedacf8cb5e632293 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -166,6 +166,7 @@ void Inkscape::ObjectSnapper::_collectNodes(Inkscape::Snapper::PointType const &
if (SP_IS_USE(*i)) {
root_item = sp_use_root(SP_USE(*i));
}
if (SP_IS_USE(*i)) {
root_item = sp_use_root(SP_USE(*i));
}
+ g_return_if_fail(root_item);
//Collect all nodes so we can snap to them
if (_snap_to_itemnode) {
//Collect all nodes so we can snap to them
if (_snap_to_itemnode) {
@@ -271,6 +272,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &
if (SP_IS_USE(*i)) {
i2doc = sp_use_get_root_transform(SP_USE(*i));
root_item = sp_use_root(SP_USE(*i));
if (SP_IS_USE(*i)) {
i2doc = sp_use_get_root_transform(SP_USE(*i));
root_item = sp_use_root(SP_USE(*i));
+ g_return_if_fail(root_item);
} else {
i2doc = sp_item_i2doc_affine(*i);
root_item = *i;
} else {
i2doc = sp_item_i2doc_affine(*i);
root_item = *i;
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index dc1774e3ddac495271526904bd9a161ae6f719cd..590103d36b023bd8e72c2c7c481b4331e5a0dcbf 100644 (file)
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
/**
* Returns the ultimate original of a SPUse (i.e. the first object in the chain of its originals
/**
* Returns the ultimate original of a SPUse (i.e. the first object in the chain of its originals
- * which is not an SPUse).
+ * which is not an SPUse). If no original is found, NULL is returned (it is the responsibility
+ * of the caller to make sure that this is handled correctly).
*
* Note that the returned is the clone object, i.e. the child of an SPUse (of the argument one for
* the trivial case) and not the "true original".
*
* Note that the returned is the clone object, i.e. the child of an SPUse (of the argument one for
* the trivial case) and not the "true original".
while (SP_IS_USE(orig)) {
orig = SP_USE(orig)->child;
}
while (SP_IS_USE(orig)) {
orig = SP_USE(orig)->child;
}
- g_assert(SP_IS_ITEM(orig));
+ g_return_val_if_fail(SP_IS_ITEM(orig), NULL);
return SP_ITEM(orig);
}
return SP_ITEM(orig);
}
// Track the ultimate source of a chain of uses.
SPItem *orig = sp_use_root(use);
// Track the ultimate source of a chain of uses.
SPItem *orig = sp_use_root(use);
+ g_return_val_if_fail(orig, NULL);
// Calculate the accumulated transform, starting from the original.
NR::Matrix t = sp_use_get_root_transform(use);
// Calculate the accumulated transform, starting from the original.
NR::Matrix t = sp_use_get_root_transform(use);
SPUse *use = SP_USE(item);
SPItem *root = sp_use_root(use);
SPUse *use = SP_USE(item);
SPItem *root = sp_use_root(use);
+ g_return_if_fail(root);
SPItemClass const &item_class = *(SPItemClass const *) G_OBJECT_GET_CLASS(root);
if (item_class.snappoints) {
SPItemClass const &item_class = *(SPItemClass const *) G_OBJECT_GET_CLASS(root);
if (item_class.snappoints) {