From 46c95fa7407df716795d4350506d57b2ed1fb11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 20 Mar 2014 16:47:49 +0000 Subject: [PATCH] coverity#736099 Improper use of negative value Change-Id: I065a8074fcafba123898c70eded464aa108e2e9e --- starmath/source/cursor.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index d05a1b85b022..5b9847611c9b 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -302,6 +302,11 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){ SmStructureNode* pLineParent = pLine->GetParent(); int nParentIndex = pLineParent->IndexOfSubNode(pLine); OSL_ENSURE(nParentIndex != -1, "pLine must be a subnode of pLineParent!"); + if (nParentIndex == -1) + { + delete pNewNodes; + return; + } //Convert line to list SmNodeList* pLineList = NodeToList(pLine);