diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-08-23 18:17:58 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2016-08-24 06:57:54 +0000 |
commit | e04bea2bad6839df08b1b631f1233d51088b9902 (patch) | |
tree | 7b8fe2beb05ab84f49385648d428e75d8a83db7e /starmath/source | |
parent | c899cc46fc6522b7fd7c243bf7a67dfbe2e1e586 (diff) |
SmCursor::FindTopMostNodeInLine() requires non-null argument
Change-Id: I3643c8a299276d7f3568747e6428ced4c8a6e2bf
Reviewed-on: https://gerrit.libreoffice.org/28345
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/cursor.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index a5a933edab9f..30d4c26db49c 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -258,7 +258,7 @@ void SmCursor::Delete(){ //Find an arbitrary selected node SmNode* pSNode = FindSelectedNode(mpTree); - OSL_ENSURE(pSNode != nullptr, "There must be a selection when HasSelection is true!"); + assert(pSNode); //Find the topmost node of the line that holds the selection SmNode* pLine = FindTopMostNodeInLine(pSNode, true); @@ -488,7 +488,7 @@ void SmCursor::InsertSubSup(SmSubSup eSubSup) { SmNode *pLine; if(HasSelection()) { SmNode *pSNode = FindSelectedNode(mpTree); - OSL_ENSURE(pSNode != nullptr, "There must be a selected node when HasSelection is true!"); + assert(pSNode); pLine = FindTopMostNodeInLine(pSNode, true); } else pLine = FindTopMostNodeInLine(mpPosition->CaretPos.pSelectedNode); @@ -658,7 +658,7 @@ void SmCursor::InsertBrackets(SmBracketType eBracketType) { SmNode *pLine; if(HasSelection()) { SmNode *pSNode = FindSelectedNode(mpTree); - OSL_ENSURE(pSNode != nullptr, "There must be a selected node if HasSelection()"); + assert(pSNode); pLine = FindTopMostNodeInLine(pSNode, true); } else pLine = FindTopMostNodeInLine(mpPosition->CaretPos.pSelectedNode); @@ -793,7 +793,7 @@ bool SmCursor::InsertRow() { SmNode *pLine; if(HasSelection()) { SmNode *pSNode = FindSelectedNode(mpTree); - OSL_ENSURE(pSNode != nullptr, "There must be a selected node if HasSelection()"); + assert(pSNode); pLine = FindTopMostNodeInLine(pSNode, true); } else pLine = FindTopMostNodeInLine(mpPosition->CaretPos.pSelectedNode); @@ -912,7 +912,7 @@ void SmCursor::InsertFraction() { SmNode *pLine; if(HasSelection()) { SmNode *pSNode = FindSelectedNode(mpTree); - OSL_ENSURE(pSNode != nullptr, "There must be a selected node when HasSelection is true!"); + assert(pSNode); pLine = FindTopMostNodeInLine(pSNode, true); } else pLine = FindTopMostNodeInLine(mpPosition->CaretPos.pSelectedNode); @@ -1160,6 +1160,7 @@ void SmCursor::Copy(){ AnnotateSelection(); //Find selected node SmNode* pSNode = FindSelectedNode(mpTree); + assert(pSNode); //Find visual line SmNode* pLine = FindTopMostNodeInLine(pSNode, true); assert(pLine); @@ -1212,10 +1213,7 @@ SmNodeList* SmCursor::CloneList(SmClipboard &rClipboard){ } SmNode* SmCursor::FindTopMostNodeInLine(SmNode* pSNode, bool MoveUpIfSelected){ - //If we haven't got a subnode - if(!pSNode) - return nullptr; - + assert(pSNode); //Move up parent until we find a node who's //parent is NULL or isn't selected and not a type of: // SmExpressionNode |