r23973 by jghali - Fix potential crash

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 8 13:22:55 UTC 2020


Author: jghali
Date: Sat Aug  8 13:22:55 2020
New Revision: 23973

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23973
Log:
Fix potential crash

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23973&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sat Aug  8 13:22:55 2020
@@ -6892,6 +6892,8 @@
 		{
 			QStringList actTab = m_prefsManager.appPrefs.uiPrefs.tabbedPalettes[i].palettes;
 			QDockWidget *container = findChild<QDockWidget *>(actTab[0]);
+			if (!container)
+				continue;
 			QList<QTabBar *> bars = findChildren<QTabBar *>(QString());
 			bool found = false;
 			for (int j = 0; j < bars.count(); ++j)
@@ -6899,18 +6901,16 @@
 				QTabBar *bar = bars[j];
 				for (int k = 0; k < bar->count(); k++)
 				{
-					QObject *obj = (QObject*)bar->tabData(k).toULongLong();
-					if (obj != nullptr)
+					QObject *obj = (QObject*) bar->tabData(k).toULongLong();
+					if (obj == nullptr)
+						continue;
+					if (obj->objectName() != container->objectName())
+						continue;
+					if (m_prefsManager.appPrefs.uiPrefs.tabbedPalettes[i].activeTab > -1)
 					{
-						if (obj->objectName() == container->objectName())
-						{
-							if (m_prefsManager.appPrefs.uiPrefs.tabbedPalettes[i].activeTab > -1)
-							{
-								bar->setCurrentIndex(m_prefsManager.appPrefs.uiPrefs.tabbedPalettes[i].activeTab);
-								found = true;
-								break;
-							}
-						}
+						bar->setCurrentIndex(m_prefsManager.appPrefs.uiPrefs.tabbedPalettes[i].activeTab);
+						found = true;
+						break;
 					}
 				}
 				if (found)




More information about the scribus-commit mailing list