r24812 by jghali - Fix crash in search&replace dialog by making findParagraphStyle(ScribusDoc*, const ParagraphStyle&) and findParagraphStyle(ScribusDoc*, const QString&) behavior consistent in the case of unnamed styles
scribus-commit
scribus-commit at lists.scribus.net
Wed Jan 19 20:13:22 UTC 2022
Author: jghali
Date: Wed Jan 19 20:13:22 2022
New Revision: 24812
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24812
Log:
Fix crash in search&replace dialog by making findParagraphStyle(ScribusDoc*, const ParagraphStyle&) and findParagraphStyle(ScribusDoc*, const QString&) behavior consistent in the case of unnamed styles
Modified:
trunk/Scribus/scribus/util_text.cpp
Modified: trunk/Scribus/scribus/util_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24812&path=/trunk/Scribus/scribus/util_text.cpp
==============================================================================
--- trunk/Scribus/scribus/util_text.cpp (original)
+++ trunk/Scribus/scribus/util_text.cpp Wed Jan 19 20:13:22 2022
@@ -43,7 +43,12 @@
int findParagraphStyle(ScribusDoc* doc, const QString &name)
{
- for (int i=0; i < doc->paragraphStyles().count(); ++i)
+ // This make behavior consistent with findParagraphStyle(ScribusDoc*, const ParagraphStyle&)
+ // for unnamed styles
+ if (name.isEmpty())
+ return -1;
+
+ for (int i = 0; i < doc->paragraphStyles().count(); ++i)
{
if (name == doc->paragraphStyles()[i].name())
return i;
More information about the scribus-commit
mailing list