From 1de4bd9088bf9311e41bbe3eef098ba79504c071 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Sat, 2 Jan 2016 12:29:50 +0900 Subject: starmath: Assert that SmRootNode always has three children Change-Id: I9d1b47fc7fc26254f331967dd58f60d88bd2112f Reviewed-on: https://gerrit.libreoffice.org/21036 Tested-by: Jenkins Reviewed-by: Michael Stahl --- starmath/inc/node.hxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'starmath/inc') diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index cf6e47212371..90e7a570351c 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -26,6 +26,7 @@ #include "rect.hxx" #include "format.hxx" +#include #include #include #include @@ -1319,7 +1320,7 @@ public: inline SmNode* SmRootNode::Argument() { - OSL_ASSERT( GetNumSubNodes() > 0 ); + assert( GetNumSubNodes() == 3 ); return GetSubNode( 0 ); } inline const SmNode* SmRootNode::Argument() const @@ -1328,7 +1329,8 @@ inline const SmNode* SmRootNode::Argument() const } inline SmRootSymbolNode* SmRootNode::Symbol() { - OSL_ASSERT( GetNumSubNodes() > 1 && GetSubNode( 1 )->GetType() == NROOTSYMBOL ); + assert( GetNumSubNodes() == 3 ); + OSL_ASSERT( GetSubNode( 1 )->GetType() == NROOTSYMBOL ); return static_cast< SmRootSymbolNode* >( GetSubNode( 1 )); } inline const SmRootSymbolNode* SmRootNode::Symbol() const @@ -1337,7 +1339,7 @@ inline const SmRootSymbolNode* SmRootNode::Symbol() const } inline SmNode* SmRootNode::Body() { - OSL_ASSERT( GetNumSubNodes() > 2 ); + assert( GetNumSubNodes() == 3 ); return GetSubNode( 2 ); } inline const SmNode* SmRootNode::Body() const -- cgit