Help:Null Refererce using MailMerge.FieldMergingCallback

Hi,I encountered a problem when using MailMerge.FieldMergingCallback.I have nested Mail Merge Regions in my template,and I would like to have the empty paragraphs removed from generated doc to let it looks like a single table.I have posted my sample code and my template in the attachment.
Could anybody help my out?

Hi there,
Thanks for your inquiry.
Please try using the following changes to your code:

List <Node> nodeList = new List <Node> ();
// the following statement will cause null reference.
currentTemplate.MailMerge.FieldMergingCallback = new EmptyPragraphRemover(nodeList);
DumpTable(currentTemplate, tables[i], i % 2 == 0);
foreach(Node node in nodeList)
    if (node.ParentNode != null)
class EmptyPragraphRemover: IFieldMergingCallback
    private List <Node> mList;
    public EmptyPragraphRemover(List <Node> list)
        mList = list;
    public void FieldMerging(FieldMergingArgs args)
        if (args.FieldName == MergeFields_TableRemark ||
            args.FieldName == MergeFields_FieldAllowNull)
            Aspose.Words.Tables.Table table = (Aspose.Words.Tables.Table) args.Field.Start.GetAncestor(NodeType.Table);
            if (table != null)
                // Remove paragraphs before and after table.
                if (table.NextSibling.NodeType == NodeType.Paragraph)
                if (table.PreviousSibling.NodeType == NodeType.Paragraph)
    public void ImageFieldMerging(ImageFieldMergingArgs args)