r22651 by jghali - refactor scripter's GetUniqueItem()

scribus-commit scribus-commit at lists.scribus.net
Mon Aug 27 18:56:37 UTC 2018


Author: jghali
Date: Mon Aug 27 18:56:37 2018
New Revision: 22651

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22651
Log:
refactor scripter's GetUniqueItem()

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

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22651&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp	Mon Aug 27 18:56:37 2018
@@ -101,16 +101,14 @@
 /* 04/07/10 returns selection if is not name specified  pv  */
 PageItem* GetUniqueItem(const QString& name)
 {
-	if (name.length()==0)
+	if (name.length() == 0)
+	{
 		if (ScCore->primaryMainWindow()->doc->m_Selection->count() != 0)
 			return ScCore->primaryMainWindow()->doc->m_Selection->itemAt(0);
-		else
-		{
-			PyErr_SetString(NoValidObjectError, QString("Cannot use empty string for object name when there is no selection").toLocal8Bit().constData());
-			return nullptr;
-		}
-	else
-		return getPageItemByName(name);
+		PyErr_SetString(NoValidObjectError, QString("Cannot use empty string for object name when there is no selection").toLocal8Bit().constData());
+		return nullptr;
+	}
+	return getPageItemByName(name);
 }
 
 PageItem* getPageItemByName(const QString& name)




More information about the scribus-commit mailing list