r20512 by craig -

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 2 09:55:33 UTC 2015


Author: craig
Date: Mon Nov  2 09:55:33 2015
New Revision: 20512

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20512
Log:
#13408: Fix crash when some new command line options do not have an argument provided

Modified:
    trunk/Scribus/scribus/scribusapp.cpp

Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20512&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp	(original)
+++ trunk/Scribus/scribus/scribusapp.cpp	Mon Nov  2 09:55:33 2015
@@ -229,6 +229,10 @@
 			// last argument. FIXME: Qt only understands -display not --display and -d , we need to work
 			// around this.
 		} else if (arg == ARG_PREFS || arg == ARG_PREFS_SHORT) {
+			if (argi+1 == argsc) {
+				std::cout << tr("Option %1 require an argument.").arg(arg).toLocal8Bit().data() << std::endl;
+				std::exit(EXIT_FAILURE);
+			}
 			prefsUserFile = QFile::decodeName(args[argi + 1].toLocal8Bit());
 			if (!QFileInfo(prefsUserFile).exists()) {
 				showError(prefsUserFile);
@@ -240,6 +244,10 @@
 		{
 			// Andreas Vox: Qt/Mac has -psn_blah flags that must be accepted.
 		} else if (arg == ARG_PYTHONSCRIPT || arg == ARG_PYTHONSCRIPT_SHORT) {
+			if (argi+1 == argsc) {
+				std::cout << tr("Option %1 require an argument.").arg(arg).toLocal8Bit().data() << std::endl;
+				std::exit(EXIT_FAILURE);
+			}
 			pythonScript = QFile::decodeName(args[argi + 1].toLocal8Bit());
 			if (!QFileInfo(pythonScript).exists()) {
 				showError(pythonScript);




More information about the scribus-commit mailing list