r21990 by craig - Coverity 1350064: Unchecked return value on file open

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 23 09:55:27 UTC 2017


Author: craig
Date: Sun Apr 23 09:55:27 2017
New Revision: 21990

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21990
Log:
Coverity 1350064: Unchecked return value on file open

Modified:
    trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21990&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp	(original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp	Sun Apr 23 09:55:27 2017
@@ -52,15 +52,18 @@
 	about->description = "Barcode Writer in Pure Postscript generates all barcode formats entirely within PostScript hence this plugin requires Ghostscript to be installed on your system. http://bwipp.terryburton.co.uk";
 
 	// Extract the version information from BWIPP
-        QFile f( ScPaths::instance().shareDir() + QString("/plugins/barcode.ps") );
-        f.open(QIODevice::ReadOnly);
-        QTextStream ts(&f);
-        QString bwipp = ts.read(150);
-        f.close();
-        QRegExp rx("\\n% Barcode Writer in Pure PostScript - Version ([\\d-]+)\\n");
-	rx.indexIn(bwipp);
-	about->version = "Backend: "+rx.cap(1);
-
+	QFile f( ScPaths::instance().shareDir() + QString("/plugins/barcode.ps") );
+	if(f.open(QIODevice::ReadOnly))
+	{
+		QTextStream ts(&f);
+		QString bwipp = ts.read(150);
+		f.close();
+		QRegExp rx("\\n% Barcode Writer in Pure PostScript - Version ([\\d-]+)\\n");
+		rx.indexIn(bwipp);
+		about->version = "Backend: "+rx.cap(1);
+	}
+	else
+		about->version = "Unable to open backend file";
 	// about->releaseDate
 	about->copyright = QString::fromUtf8("Backend: Copyright (c) 2004-2015 Terry Burton - tez at terryburton.co.uk\nFrontend: Copyright (c) 2005 Petr Van\xc4\x9bk - petr at scribus.info");
 	about->license = "Backend: MIT/X-Consortium, Frontend: GPL";




More information about the scribus-commit mailing list