r21987 by craig - Coverity 1350060: Unchecked return value on file open

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 23 09:49:13 UTC 2017


Author: craig
Date: Sun Apr 23 09:49:13 2017
New Revision: 21987

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21987
Log:
Coverity 1350060: 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=21987&path=/trunk/Scribus/scribus/ui/latexeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/latexeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/latexeditor.cpp	Sun Apr 23 09:49:13 2017
@@ -408,7 +408,8 @@
 
 void LatexEditor::loadSettings()
 {
-	while (tabWidget->count()>1) {
+	while (tabWidget->count()>1)
+	{
 		QWidget *widget = tabWidget->widget(1);
 		tabWidget->removeTab(1);
 		delete widget;
@@ -416,17 +417,27 @@
 	widgetMap.clear();
 	
 	QFile f(LatexConfigParser::absoluteFilename(frame->configFile()));
-	f.open(QIODevice::ReadOnly);
+	if (!f.open(QIODevice::ReadOnly))
+	{
+		qDebug()<<"Unable to open config file in LatexEditor::loadSettings()";
+		return;
+	}
 	I18nXmlStreamReader xml(&f);
-	while (!xml.atEnd()) {
+	while (!xml.atEnd())
+	{
 		xml.readNext();
 		if (xml.isWhitespace() || xml.isComment()) continue;
-		if (xml.isStartElement() && xml.name() == "tab") {
-			if (xml.attributes().value("type") == "settings") {
+		if (xml.isStartElement() && xml.name() == "tab")
+		{
+			if (xml.attributes().value("type") == "settings")
+			{
 				createNewSettingsTab(&xml);
-			} else if (xml.attributes().value("type") == "items") {
+			} else if (xml.attributes().value("type") == "items")
+			{
 				createNewItemsTab(&xml);
-			} else {
+			}
+			else
+			{
 				qWarning() << "XML-ERROR: " << xml.lineNumber() << ":" 
 						<< xml.columnNumber() << ":" << "Unknow tab type"
 						<< xml.attributes().value("type").toString();




More information about the scribus-commit mailing list