summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-06-03 04:35:02 +0900
committerMichael Stahl <mstahl@redhat.com>2016-06-03 11:01:09 +0000
commit013f9d5aaa5799a7fe3ddfc2ff61ec449c0462b0 (patch)
tree9a411a779b48bd0004c73dc69162cddd61a0f73e /starmath
parent6d29b6d80aef8b94cd8ef0608c2af31532afc942 (diff)
Null pointer dereferences must not happen
This is a follow-up of 09981cd6383ecb99e4b6c83b98b03af5cf3ff59b. Inspired by coverity#1362478 etc. Change-Id: If5507c52552393cccbb255cbf4b7e9f4b80db917 Reviewed-on: https://gerrit.libreoffice.org/25840 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/cursor.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 3baf5e1b9f78..dab3dc497974 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -139,11 +139,14 @@ void SmCursor::BuildGraph(){
}
//Set position and anchor to first caret position
auto it = mpGraph->begin();
+ assert(it != mpGraph->end());
if(!mpPosition)
- mpPosition = (it == mpGraph->end()) ? nullptr : it->get();
+ mpPosition = it->get();
if(!mpAnchor)
mpAnchor = mpPosition;
+ assert(mpPosition);
+ assert(mpAnchor);
OSL_ENSURE(mpPosition->CaretPos.IsValid(), "Position must be valid");
OSL_ENSURE(mpAnchor->CaretPos.IsValid(), "Anchor must be valid");
}