r20894 by craig -

scribus-commit scribus-commit at lists.scribus.net
Tue Feb 2 23:23:06 UTC 2016


Author: craig
Date: Tue Feb  2 23:23:05 2016
New Revision: 20894

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20894
Log:
coverity #1350130: unchecked dynamic cast, rewrite

Modified:
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20894&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	Tue Feb  2 23:23:05 2016
@@ -695,19 +695,16 @@
 	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
-	if (!(it->asTextFrame()) && !(it->asPathText()))
+	PageItem_TextFrame* item = it->asTextFrame();
+	if (!(item) && !(it->asPathText()))
 	{
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot delete text from a non-text frame.","python error").toLocal8Bit().constData());
 		return NULL;
 	}
 	if (it->HasSel)
-		dynamic_cast<PageItem_TextFrame*>(it)->deleteSelectedTextFromFrame();
+		item->deleteSelectedTextFromFrame();
 	else
-	{
-		it->itemText.clear();
-	}
-//	Py_INCREF(Py_None);
-//	return Py_None;
+		item->itemText.clear();
 	Py_RETURN_NONE;
 }
 




More information about the scribus-commit mailing list