r21989 by craig - Coverity 1350063: Unchecked return value on file open

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 23 09:52:33 UTC 2017


Author: craig
Date: Sun Apr 23 09:52:33 2017
New Revision: 21989

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

Modified:
    trunk/Scribus/scribus/ui/latexeditor.cpp

Modified: trunk/Scribus/scribus/ui/latexeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21989&path=/trunk/Scribus/scribus/ui/latexeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/latexeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/latexeditor.cpp	Sun Apr 23 09:52:33 2017
@@ -191,10 +191,15 @@
 {
 	QString new_formula;
 	QFile f(extEditorFile);
-	f.open(QIODevice::ReadOnly);
+	if(!f.open(QIODevice::ReadOnly))
+	{
+		qDebug()<<"Unable to open editor file in LatexEditor::loadExternalEditorFile()";
+		return;
+	}
 	new_formula = QString::fromUtf8(f.readAll());
 	f.close();
-	if (!new_formula.isEmpty()) {
+	if (!new_formula.isEmpty())
+	{
 		frame->setFormula(new_formula);
 		sourceTextEdit->setPlainText(new_formula);
 	}
@@ -205,7 +210,8 @@
 {
 	externalEditorPushButton->setEnabled(true);
 	externalEditorPushButton->setText( tr("Run External Editor...") );
-	if (exitCode && extEditor) {
+	if (exitCode && extEditor)
+	{
 		qCritical() << "RENDER FRAME: Editor failed. Output was: " << 
 			qPrintable(QString(extEditor->readAllStandardOutput()));
 		ScMessageBox::critical(0, tr("Error"), "<qt>" +




More information about the scribus-commit mailing list