From 0d06b0c57e28f85740e806b7e0d6477d74f2f5c0 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Wed, 26 Mar 2008 06:04:04 +0000 Subject: fix crash caused by a gradient without a zero-offset stop (bzr r5191) --- src/gradient-chemistry.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 057877daf..303db8849 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -555,6 +555,12 @@ SPStop* sp_get_stop_i(SPGradient *gradient, guint stop_i) { SPStop *stop = sp_first_stop (gradient); + + // if this is valid but weird gradient without an offset-zero stop element, + // inkscape has created a handle for the start of gradient anyway, + // so when it asks for stop N that corresponds to stop element N-1 + if (stop->offset != 0) + stop_i --; for (guint i=0; i < stop_i; i++) { if (!stop) return NULL; -- cgit v1.2.3