diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-01-02 12:29:50 +0900 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-12 14:24:52 +0000 |
commit | 1de4bd9088bf9311e41bbe3eef098ba79504c071 (patch) | |
tree | beb48cb2ba718d6ba916b3bf151f4cd84e415f96 | |
parent | 75f0f9d5538577e0d4923b4d46ba6f88b6199814 (diff) |
starmath: Assert that SmRootNode always has three children
Change-Id: I9d1b47fc7fc26254f331967dd58f60d88bd2112f
Reviewed-on: https://gerrit.libreoffice.org/21036
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | starmath/inc/node.hxx | 8 |
1 files changed, 5 insertions, 3 deletions
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 <cassert> #include <memory> #include <vector> #include <deque> @@ -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 |