r20485 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 22 17:43:34 UTC 2015


Author: jghali
Date: Thu Oct 22 17:43:34 2015
New Revision: 20485

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20485
Log:
#13451: Invalid PDF when specifying a non-existing page to export

Modified:
    branches/Version14x/Scribus/scribus/pdfopts.cpp

Modified: branches/Version14x/Scribus/scribus/pdfopts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20485&path=/branches/Version14x/Scribus/scribus/pdfopts.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pdfopts.cpp	(original)
+++ branches/Version14x/Scribus/scribus/pdfopts.cpp	Thu Oct 22 17:43:34 2015
@@ -148,9 +148,31 @@
 
 void PDFExportDialog::DoExport()
 {
+	// Check the page ranges
+	bool hasInvalidPageRange = false;
+	QString pageString(this->getPagesString());
+	std::vector<int> pageNumbers;
+
+	parsePagesString(pageString, &pageNumbers, doc->DocPages.count());
+	for (size_t i = 0; i < pageNumbers.size(); ++i)
+	{
+		int pageNumber = pageNumbers[i];
+		if (pageNumber < 1 || pageNumber > doc->DocPages.count())
+		{
+			hasInvalidPageRange = true;
+			break;
+		}
+	}
+
+	if ((pageNumbers.size() == 0) || hasInvalidPageRange)
+	{
+		QMessageBox::warning(this, CommonStrings::trWarning, tr("The range of pages to export is invalid.\nPlease check it and try again."));
+		return;
+	}
+
+	// Checking if the path exists
 	bool createPath = false;
 	QString fn = QDir::fromNativeSeparators(fileNameLineEdit->text());
-	// Checking if the path exists
 	QFileInfo fi(fn);
 	QString dirPath = QDir::toNativeSeparators(fi.absolutePath());
 	if (!QFile::exists(fi.absolutePath()))




More information about the scribus-commit mailing list