Index out of range exception on TabStops getter for Paragraph with ListLevel

I'm getting the exception below when the the following code is executed. The code is in the process of creating an Aspose.Words document, and wants to clear out any existing tabstops that may have been inherited from the previously added Paragraph. Can you confirm this bug, and possibly also provide a workaround?

Thanks!

while (asposePara.ParagraphFormat.TabStops.Count > 0)
asposePara.ParagraphFormat.TabStops.RemoveByIndex(0);

Stack Trace:


[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.Collections.ArrayList.get_Item(Int32 index) +2776269
Aspose.Words.ListLevels.get_Item(Int32 index) +10
Aspose.Words.Lists.x90a164d2f15bfc09(Int32 x43eb71c4e55e38d0, Int32 x66bbd7ed8c65740d) +97
Aspose.Words.Paragraph.x267da71d3c14745f(Int32 xba08ce632055a1d9) +101
Aspose.Words.ParagraphFormat.get_TabStops() +18

Also, I put a try/catch around the above code as a workaround, but get a similar exception when I try to save the document:

Line 171: _toDoc.Save(stream, format);


Stack Trace:

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]

System.Collections.ArrayList.get_Item(Int32 index) +2776269
Aspose.Words.ListLevels.get_Item(Int32 index) +10
Aspose.Words.Lists.x90a164d2f15bfc09(Int32 x43eb71c4e55e38d0, Int32 x66bbd7ed8c65740d) +97
Aspose.Words.Paragraph.x267da71d3c14745f(Int32 xba08ce632055a1d9) +101
Aspose.Words.ParagraphFormat.get_Bidi() +16
x9e260ffa1ac41ffa.x163859bfa28558c4.VisitParagraphStart(Paragraph para) +175
Aspose.Words.Paragraph.Accept(DocumentVisitor visitor) +14
Aspose.Words.CompositeNode.x464d2134480a7bf2(DocumentVisitor x672ff13faf031f3d) +46
Aspose.Words.Body.Accept(DocumentVisitor visitor) +53
x9e260ffa1ac41ffa.x163859bfa28558c4.x51ee56decc29a9da(Section xb32f8dd719a105db) +138
x9e260ffa1ac41ffa.x163859bfa28558c4.x160a0bf4de8f6bd0() +379
x9e260ffa1ac41ffa.x163859bfa28558c4.x8cac5adfe79bc025(x8556eed81191af11 x5ac1382edb7bf2c2) +40
Aspose.Words.Document.Save(Stream stream, SaveFormat saveFormat) +151


Ah, I think I see my problem. I’m assigning a bogus ListLevel (-1) to the Paragraph earlier in the code. So it’s my fault, sorry. You may want to validate ListLevels when they’re assigned.