summaryrefslogtreecommitdiffstats
path: root/src/object/sp-use-reference.cpp
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-02-18 03:27:54 +0000
committerNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-03-06 05:01:11 +0000
commitabf707b5bc033615b24f7048fcccaa3a9a5148c6 (patch)
tree8e9144f4f88c5e4dc93954e2ed26544c4bb4d815 /src/object/sp-use-reference.cpp
parentIgnore more stuff (diff)
downloadinkscape-abf707b5bc033615b24f7048fcccaa3a9a5148c6.tar.gz
inkscape-abf707b5bc033615b24f7048fcccaa3a9a5148c6.zip
Stop crash on loading text on path
If path is below text in xml, early attempt to get text path leads to call to nullptr. Fixes https://gitlab.com/inkscape/inbox/issues/134
Diffstat (limited to 'src/object/sp-use-reference.cpp')
-rw-r--r--src/object/sp-use-reference.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/object/sp-use-reference.cpp b/src/object/sp-use-reference.cpp
index 61a8330a8..f2b857566 100644
--- a/src/object/sp-use-reference.cpp
+++ b/src/object/sp-use-reference.cpp
@@ -25,7 +25,7 @@
bool SPUseReference::_acceptObject(SPObject * const obj) const
{
- return URIReference::_acceptObject(obj);
+ return URIReference::_acceptObject(obj);
}
@@ -208,18 +208,16 @@ void SPUsePath::refresh_source()
SPItem *item = SP_ITEM(refobj);
- if (SP_IS_SHAPE(item))
- {
- originalPath = SP_SHAPE(item)->getCurve()->copy();
- }
- else if (SP_IS_TEXT(item))
- {
+ if (SP_IS_SHAPE(item)) {
+ SPCurve *originalCurve = SP_SHAPE(item)->getCurve();
+ if (originalCurve != nullptr) {
+ originalPath = originalCurve->copy();
+ } else {
+ sourceDirty = true;
+ }
+ } else if (SP_IS_TEXT(item)) {
originalPath = SP_TEXT(item)->getNormalizedBpath()->copy();
}
- else
- {
- return;
- }
}