Fixed bug avoiding drawing curve

If the variable holding the canvas layer is not called layer (as in the
demo file), no curve would be drawn at all.