r22512 by jghali - fix build error with gcc

scribus-commit scribus-commit at lists.scribus.net
Wed May 2 07:49:50 UTC 2018


Author: jghali
Date: Wed May  2 07:49:50 2018
New Revision: 22512

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22512
Log:
fix build error with gcc

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22512&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Wed May  2 07:49:50 2018
@@ -4073,17 +4073,19 @@
 
 QStringList ScribusDoc::getUsedPatternsHelper(QString pattern, QStringList &results) const
 {
-	if (!docPatterns.contains(pattern))
+	auto patIter = docPatterns.constFind(pattern);
+	if (patIter == docPatterns.end())
 		return QStringList();
-	const ScPattern *pat = &docPatterns[pattern];
+	const ScPattern &pat = patIter.value();
+
 	QStringList pats;
-	for (int i = 0; i < pat->items.count(); ++i)
+	for (int i = 0; i < pat.items.count(); ++i)
 	{
 		QList<PageItem*> allItems;
-		if (pat->items.at(i)->isGroup())
-			allItems = pat->items.at(i)->getAllChildren();
+		if (pat.items.at(i)->isGroup())
+			allItems = pat.items.at(i)->getAllChildren();
 		else
-			allItems.append(pat->items.at(i));
+			allItems.append(pat.items.at(i));
 		for (int j = 0; j < allItems.count(); j++)
 		{
 			PageItem *currItem = allItems.at(j);
@@ -4247,13 +4249,17 @@
 
 QStringList ScribusDoc::getUsedSymbolsHelper(QString pattern, QStringList &results) const
 {
-	const ScPattern *pat = &docPatterns[pattern];
+	auto patIter = docPatterns.constFind(pattern);
+	if (patIter == docPatterns.end())
+		return QStringList();
+	const ScPattern &pat = patIter.value();
+
 	QStringList pats;
-	for (int i = 0; i < pat->items.count(); ++i)
-	{
-		if (pat->items.at(i)->itemType() == PageItem::Symbol)
-		{
-			const QString& patName = pat->items.at(i)->pattern();
+	for (int i = 0; i < pat.items.count(); ++i)
+	{
+		if (pat.items.at(i)->itemType() == PageItem::Symbol)
+		{
+			const QString& patName = pat.items.at(i)->pattern();
 			if (!patName.isEmpty() && !results.contains(patName))
 				pats.append(patName);
 		}




More information about the scribus-commit mailing list