Kaydet (Commit) 594733a5 authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Caolán McNamara

starmath: Assert FindIndex()'s precondition

by using std::assert rather thatn DBG_ASSERT.

Change-Id: I8fca2b82f8d86a843c024556a0a29c7848b1e602
Reviewed-on: https://gerrit.libreoffice.org/19294Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2bd26bfc
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment