Aspose.PSD 24.8.0 issue with particular document when iterating through Layers

Hi! We’ve been testing Aspose.PSD 24.7.0 and 24.8.0 both produce a new error for a particular document. It works on 24.6.0 fyi
The code is the following:

var psdImage = (PsdImage)Image.Load(psdFilePath);
foreach (var layer in psdImage.Layers)
{
if (layer is TextLayer textLayer)
{
Stopwatch w = Stopwatch.StartNew();

    var newPortion = textLayer.TextData.ProducePortions(
    new[] { "adding text" },
    null,
    null
    ).First();

    textLayer.TextData.AddPortion(newPortion);
    textLayer.TextData.UpdateLayerData();
    w.Stop();
    Console.WriteLine($"Portion added, time: {w}");
}

}
Error at some point in the iteration of layers:

System.ArgumentOutOfRangeException
HResult=0x80131502
Message=Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRange_IndexMustBeLessException() in /_/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs:line 118
at .(String , Int32 )
at .[TResult](String , Int32 )
at .( )
at …ctor(TextLayer )
at Aspose.PSD.FileFormats.Psd.Layers.TextLayer.get_TextData()
at Program.TestPSD(Int32 index) in C:\code\Slides\Slides\Program.cs:line 69
at Program.Main() in C:\code\Slides\Slides\Program.cs:line 28

image.png (28.3 KB)

file causing the issue:
__Brochure_Template_PSD_2.7z (1.2 MB)

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

Issue ID(s): PSDNET-2176

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.

The issues you have found earlier (filed as PSDNET-2176) have been fixed in this update. This message was posted using Bugs notification tool by yaroslav.lisovskyi