System.IndexOutOfRangeException when saving PSD file

Hi Support,
I’m getting System.IndexOutOfRangeException when saving PSD file after editing.
Below is the code:

public ActionResult Update_Color(string unit)
{
using (var im = (PsdImage)Aspose.PSD.Image.Load(FilePath.GetDataDir_PSD(), new PsdLoadOptions()))
{
foreach (var layer in im.Layers)
{
if (layer.Name == unit)
{
var fillLayer = layer as FillLayer;
if (fillLayer != null)
{
var settings = fillLayer.FillSettings as IColorFillSettings;
if (settings != null)
{
settings.Color = Aspose.PSD.Color.FromName(“Red”);
fillLayer.Update();
break;
}
}
}
}
im.Save(FilePath.GetDataDir_PSD_Updated(), true);
im.Dispose();
}
FileInfo file = new FileInfo(FilePath.GetDataDir_PSD_Updated());
file.CopyTo(FilePath.GetDataDir_PSD(),true);
return Content(unit + " updated successfully!");
}

I’m getting error on im.Save(FilePath.GetDataDir_PSD_Updated(), true);

Below is the screenshot of exception:
image.png (13.0 KB)

@Abdul_Ahad i can’t reproduce issue with my PSD file and your code, provide please your source file.

Hi @yaroslav.lisovskyi,
Thank you for your response. You can get the source code from below repo

@Abdul_Ahad
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-1925

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.