[Libreoffice-commits] core.git: starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Tue Nov 10 04:26:53 PST 2015
starmath/source/node.cxx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 594733a5410fed82968d10a9854a82e8d896f250
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Sat Oct 10 18:51:07 2015 +0900
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index cf50b77..a1847ef 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;
}
More information about the Libreoffice-commits
mailing list