diff options
| author | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-09-12 10:28:31 +0000 |
|---|---|---|
| committer | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-09-12 10:28:31 +0000 |
| commit | 812258dc01faa6b26534a2aa5d7536b4cb892c01 (patch) | |
| tree | c831e94220c555eb0b5db4773585c6daf8b2a8e4 /src/sp-item.cpp | |
| parent | cmake: fix "make install" to actually produce a runnable distribution on Windows (diff) | |
| download | inkscape-812258dc01faa6b26534a2aa5d7536b4cb892c01.tar.gz inkscape-812258dc01faa6b26534a2aa5d7536b4cb892c01.zip | |
Fixed out of range pointers
Fixed bugs:
- https://launchpad.net/bugs/1620253
(bzr r15114)
Diffstat (limited to 'src/sp-item.cpp')
| -rw-r--r-- | src/sp-item.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 0ba74f9fd..e03b715c0 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -317,8 +317,11 @@ void SPItem::lowerOne() { auto next_lower = find_last_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); if (next_lower != parent->children.iterator_to(*this)) { - next_lower--; - Inkscape::XML::Node *ref = next_lower->getRepr(); + Inkscape::XML::Node *ref = nullptr; + if (next_lower != parent->children.begin()) { + next_lower--; + ref = next_lower->getRepr(); + } getRepr()->parent()->changeOrder(getRepr(), ref); } } @@ -326,8 +329,11 @@ void SPItem::lowerOne() { void SPItem::lowerToBottom() { auto bottom = std::find_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); if (bottom != parent->children.iterator_to(*this)) { - bottom--; - Inkscape::XML::Node *ref = bottom->getRepr() ; + Inkscape::XML::Node *ref = nullptr; + if (bottom != parent->children.begin()) { + bottom--; + ref = bottom->getRepr(); + } parent->getRepr()->changeOrder(getRepr(), ref); } } |
