From: buliabyak Date: Wed, 26 Mar 2008 06:04:04 +0000 (+0000) Subject: fix crash caused by a gradient without a zero-offset stop X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5cb398263cca4253fbb1f27a5dc524c71522a268;p=inkscape.git fix crash caused by a gradient without a zero-offset stop --- 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;