|
@@ -1998,6 +1998,8 @@ procedure TLazPaintImage.MoveLayer(AFromIndex, AToIndex: integer);
|
|
|
begin
|
|
|
if (AFromIndex < 0) or (AFromIndex >= NbLayers) then
|
|
|
raise exception.Create('Index out of bounds');
|
|
|
+ if AToIndex < 0 then AToIndex := 0;
|
|
|
+ if AToIndex >= NbLayers then AToIndex := NbLayers-1;
|
|
|
if not CheckNoAction then exit;
|
|
|
try
|
|
|
AddUndo(FCurrentState.MoveLayer(AFromIndex,AToIndex));
|