Error in Word 2007

I am using the following code to unlink all the fields in a document. The attached document throws an error (System.NullReferenceException: Object reference not set to an instance of an object) on line 17 of the code below. This code has worked fine for many documents, but for documents which are done using Word 2007, we receive this error. Thank you for your help with this.
Code to unlink fields:

ArrayList propertyStarts = new ArrayList();
NodeCollection starts = doc.GetChildNodes(NodeType.FieldStart, true);
foreach (FieldStart start in starts)
{
    if (start.FieldType == FieldType.FieldDocProperty)
    {
        propertyStarts.Add(start);
    }
}
foreach (FieldStart start in propertyStarts)
{
    Node currentNode = start;
    Node fieldSeparator = null;
    while (currentNode.NodeType != NodeType.FieldSeparator)
    {
        currentNode = currentNode.NextSibling;
        currentNode.PreviousSibling.Remove();
    }
    fieldSeparator = currentNode;
    while (currentNode.NodeType != NodeType.FieldEnd)
    {
        currentNode = currentNode.NextSibling;
    }
    fieldSeparator.Remove();
    currentNode.Remove();
}

Hi
Thanks for your inquiry. I tested your code on my side and it seems that all works fine. There were no errors.
I used the latest version of Aspose.Words (v5.2.1) for testing.
Best regards.

Prior to unlinking the fields, I have the following 2 lines of code. This seems to me to be very similar to another error I’ve been having as per https://forum.aspose.com/t/109311.
Yet it is somewhat different.

WorkDocClone.AcceptAllRevisions();
WorkDocClone.TrackRevisions = false;

Hi
Thanks for additional information. I managed to reproduce this issue. Please try using the following code:

doc.AcceptAllRevisions();
doc.TrackRevisions = false;
ArrayList propertyStarts = new ArrayList();
NodeCollection starts = doc.GetChildNodes(NodeType.FieldStart, true);
foreach (FieldStart start in starts)
{
    if (start.FieldType == FieldType.FieldDocProperty)
    {
        propertyStarts.Add(start);
    }
}
foreach (FieldStart start in propertyStarts)
{
    Node currentNode = start;
    Node fieldSeparator = null;
    while (currentNode.NodeType != NodeType.FieldSeparator && currentNode.NodeType != NodeType.FieldEnd)
    {
        currentNode = currentNode.NextSibling;
        currentNode.PreviousSibling.Remove();
    }
    if (currentNode.NodeType == NodeType.FieldSeparator)
    {
        fieldSeparator = currentNode;
        while (currentNode.NodeType != NodeType.FieldEnd)
        {
            currentNode = currentNode.NextSibling;
        }
        fieldSeparator.Remove();
    }
    currentNode.Remove();
}

Hope this helps.
Best regards.

Thank you.