[Libreoffice-commits] core.git: starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Wed Aug 24 06:58:19 UTC 2016
starmath/source/cursor.cxx | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
New commits:
commit e04bea2bad6839df08b1b631f1233d51088b9902
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Tue Aug 23 18:17:58 2016 +0900
SmCursor::FindTopMostNodeInLine() requires non-null argument
Change-Id: I3643c8a299276d7f3568747e6428ced4c8a6e2bf
Reviewed-on: https://gerrit.libreoffice.org/28345
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index a5a933e..30d4c26 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
More information about the Libreoffice-commits
mailing list