From 594733a5410fed82968d10a9854a82e8d896f250 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Sat, 10 Oct 2015 18:51:07 +0900 Subject: starmath: Assert FindIndex()'s precondition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit by using std::assert rather thatn DBG_ASSERT. Change-Id: I8fca2b82f8d86a843c024556a0a29c7848b1e602 Reviewed-on: https://gerrit.libreoffice.org/19294 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- starmath/source/node.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'starmath') diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index cf50b773e18e..a1847ef1db35 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -259,16 +260,15 @@ void SmNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) sal_uInt16 SmNode::FindIndex() const { - const SmStructureNode* pParent = GetParent(); - if (!pParent) { return 0; } + assert(mpParentNode != nullptr && "FindIndex() requires this is a subnode."); - for (sal_uInt16 i = 0; i < pParent->GetNumSubNodes(); ++i) { - if (pParent->GetSubNode(i) == this) { + for (sal_uInt16 i = 0; i < mpParentNode->GetNumSubNodes(); ++i) { + if (mpParentNode->GetSubNode(i) == this) { return i; } } - DBG_ASSERT(false, "Connection between parent and child is inconsistent."); + assert(false && "Connection between parent and child is inconsistent."); return 0; } -- cgit v1.2.3