summaryrefslogtreecommitdiffstats
path: root/src/sp-shape.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2013-05-26 19:56:10 +0000
committertavmjong-free <tavmjong@free.fr>2013-05-26 19:56:10 +0000
commit6ee24230324394a8dc26a4e46e0a679b2f29b0ec (patch)
tree28fe8f730dc6687be12c567a01f2fa099a532500 /src/sp-shape.cpp
parentboolops. allow Division to create hole (Bug 499744) (diff)
downloadinkscape-6ee24230324394a8dc26a4e46e0a679b2f29b0ec.tar.gz
inkscape-6ee24230324394a8dc26a4e46e0a679b2f29b0ec.zip
Prevent crash from middle marker when a path or polyline has only one point.
(bzr r12343)
Diffstat (limited to '')
-rw-r--r--src/sp-shape.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 4037b302c..be9f5388c 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -889,8 +889,8 @@ int SPShape::numberOfMarkers(int type)
if (pathv.size() == 0) {
return 0;
}
-
switch(type) {
+
case SP_MARKER_LOC:
{
if ( this->_marker[SP_MARKER_LOC] ) {
@@ -914,7 +914,9 @@ int SPShape::numberOfMarkers(int type)
for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) {
n += path_it->size_default() + 1;
}
- return n - 2; // minus the start and end marker.
+ n = (n > 1) ? (n - 2) : 0; // Minus the start and end marker, but never negative.
+ // A path or polyline may have only one point.
+ return n;
} else {
return 0;
}