瀏覽代碼

handle updating deleted/modified multi-image file

circular17 6 年之前
父節點
當前提交
9dc2162a7f
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      lazpaint/image/uimage.pas

+ 9 - 1
lazpaint/image/uimage.pas

@@ -481,6 +481,11 @@ end;
 
 procedure TLazPaintImage.UpdateMultiImage(AOutputFilename: string = '');
 begin
+  if not FileManager.FileExists(AOutputFilename) then
+  begin
+    ShowMessage(rsFileNotFound);
+    exit;
+  end;
   if IsIconCursor then
     UpdateIconFileUTF8(currentFilenameUTF8, AOutputFilename)
   else if IsTiff then
@@ -573,7 +578,10 @@ begin
     else
     begin
       newFrameIndex := FrameIndex;
-      tiff.Delete(newFrameIndex);
+      if newFrameIndex >= tiff.Count then
+        newFrameIndex := tiff.Count
+      else
+        tiff.Delete(newFrameIndex);
       tiff.Move(addedTiff,0,newFrameIndex);
     end;