starmath/source/node.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit 594733a5410fed82968d10a9854a82e8d896f250 Author: Takeshi Abe <t...@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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@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; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits