Simplify code with ForEachNonNull

Change-Id: Id149ecee4fa7737b529f3a3a19bb4bb9ed778dcd
Reviewed-on: https://gerrit.libreoffice.org/24778
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index b0cecfa..1104196 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -448,17 +448,13 @@ SmNode * SmStructureNode::GetSubNode(sal_uInt16 nIndex)

void SmStructureNode::GetAccessibleText( OUStringBuffer &rText ) const
{
    sal_uInt16 nNodes = GetNumSubNodes();
    for (sal_uInt16 i = 0;  i < nNodes;  ++i)
    {
        SmNode *pNode = const_cast<SmStructureNode *>(this)->GetSubNode(i);
        if (pNode)
    ForEachNonNull(const_cast<SmStructureNode *>(this),
                   [&rText](SmNode *pNode)
        {
            if (pNode->IsVisible())
                static_cast<SmStructureNode *>(pNode)->mnAccIndex = rText.getLength();
            pNode->GetAccessibleText( rText );
        }
    }
        });
}