summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2015-10-10 18:51:07 +0900
committerCaolán McNamara <caolanm@redhat.com>2015-11-10 12:26:32 +0000
commit594733a5410fed82968d10a9854a82e8d896f250 (patch)
tree082afdd0c7b8bac6ae237dca1ed3952fa412e880 /starmath
parent2bd26bfc3ca278b5b31d86bd3cfac95342009e8d (diff)
starmath: Assert FindIndex()'s precondition
by using std::assert rather thatn DBG_ASSERT. Change-Id: I8fca2b82f8d86a843c024556a0a29c7848b1e602 Reviewed-on: https://gerrit.libreoffice.org/19294 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/node.cxx10
1 files changed, 5 insertions, 5 deletions
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 <tools/gen.hxx>
#include <vcl/outdev.hxx>
+#include <cassert>
#include <math.h>
#include <float.h>
#include <vector>
@@ -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;
}