Skip to content

Commit 6a3e833

Browse files
author
livecodeali
committed
[[ Gradient Ramp Editor ]] Don't try to paint a gradient when the ramp is empty
1 parent 53b2ff9 commit 6a3e833

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

extensions/widgets/gradientrampeditor/gradientrampeditor.lcb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,16 @@ private handler paintCheckerboard() returns nothing
303303
end handler
304304

305305
private handler paintGradient() returns nothing
306-
variable tGradient as Gradient
307-
put linear gradient with ramp mGradientRamp into tGradient
308-
set the from of tGradient to point [the left of mGradientRectangle, (the top of mGradientRectangle + the bottom of mGradientRectangle) / 2]
309-
set the to of tGradient to point [the right of mGradientRectangle, (the top of mGradientRectangle + the bottom of mGradientRectangle) / 2]
310-
set the via of tGradient to point [the left of mGradientRectangle, the bottom of mGradientRectangle]
311-
add rectangle path of mGradientRectangle to this canvas
312-
set the paint of this canvas to tGradient
313-
fill this canvas
306+
if mGradientRamp is not empty then
307+
variable tGradient as Gradient
308+
put linear gradient with ramp mGradientRamp into tGradient
309+
set the from of tGradient to point [the left of mGradientRectangle, (the top of mGradientRectangle + the bottom of mGradientRectangle) / 2]
310+
set the to of tGradient to point [the right of mGradientRectangle, (the top of mGradientRectangle + the bottom of mGradientRectangle) / 2]
311+
set the via of tGradient to point [the left of mGradientRectangle, the bottom of mGradientRectangle]
312+
add rectangle path of mGradientRectangle to this canvas
313+
set the paint of this canvas to tGradient
314+
fill this canvas
315+
end if
314316
end handler
315317

316318
private handler paintRulerBottom() returns nothing

0 commit comments

Comments
 (0)