r21966 by craig - Coverity 1396754: Move mark is NULL check to avoid dereferencing

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 22 13:19:59 UTC 2017


Author: craig
Date: Sat Apr 22 13:19:59 2017
New Revision: 21966

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21966
Log:
Coverity 1396754: Move mark is NULL check to avoid dereferencing

Modified:
    trunk/Scribus/scribus/text/textcontext.cpp

Modified: trunk/Scribus/scribus/text/textcontext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21966&path=/trunk/Scribus/scribus/text/textcontext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textcontext.cpp	(original)
+++ trunk/Scribus/scribus/text/textcontext.cpp	Sat Apr 22 13:19:59 2017
@@ -84,32 +84,34 @@
 		case ExpansionPoint::MarkCE:
 			{
 				Mark* mark = expansion.getMark();
+				if (mark != NULL)
+				{
+					mark->OwnPage = m_frame->OwnPage;
+					//itemPtr and itemName set to this frame only if mark type is different than MARK2ItemType
+					if (!mark->isType(MARK2ItemType))
+					{
+						mark->setItemPtr(m_frame);
+						mark->setItemName(m_frame->itemName());
+					}
 
-				mark->OwnPage = m_frame->OwnPage;
-				//itemPtr and itemName set to this frame only if mark type is different than MARK2ItemType
-				if (!mark->isType(MARK2ItemType))
-				{
-					mark->setItemPtr(m_frame);
-					mark->setItemName(m_frame->itemName());
-				}
+					//anchors and indexes has no visible inserts in text
+					if (mark->isType(MARKAnchorType) || mark->isType(MARKIndexType))
+						return QString();
 
-				//anchors and indexes has no visible inserts in text
-				if (mark->isType(MARKAnchorType) || mark->isType(MARKIndexType))
-					return QString();
-
-				//set note marker charstyle
-				if (mark->isNoteType())
-				{
-					mark->setItemPtr(m_frame);
+					//set note marker charstyle
+					if (mark->isNoteType())
+					{
+						mark->setItemPtr(m_frame);
 
 
-					TextNote* note = mark->getNotePtr();
-					if (note == NULL)
-						return QString();
+						TextNote* note = mark->getNotePtr();
+						if (note == NULL)
+							return QString();
 
+					}
+					if (!mark->isType(MARKAnchorType) && !mark->isType(MARKIndexType))
+						return mark->getString();
 				}
-				if ((mark != NULL) && !mark->isType(MARKAnchorType) && !mark->isType(MARKIndexType))
-					return mark->getString();
 			}
 			break;
 		case ExpansionPoint::Invalid:




More information about the scribus-commit mailing list