CanvasBase.GradientFill causes a math error

I've noticed that if Width = 1 then count = 0 and causes a math error in:
  newcolor.Red    := RGBStart.Red + (i * RDiff) div count;

I think
if ADirection = gdVertical then
  count := ARect.Bottom - ARect.Top
else
  count := ARect.Right - ARect.Left;

Should be
if ADirection = gdVertical then
  count := ARect.Height
else
  count := ARect.Width;

But I'm not sure of the reasoning of the paint code. I've only seen this
crash on the AlienWindows branch. I get it when moving the splitter in
docview all the way to the right side.

Andrew