r19441 by jghali - #12624: "Get Field Names" (JavaScript) crashes Scribus if there is none

scribus-commit scribus-commit at lists.scribus.net
Wed Aug 20 23:26:42 UTC 2014


Author: jghali
Date: Wed Aug 20 23:26:42 2014
New Revision: 19441

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19441
Log:
#12624: "Get Field Names" (JavaScript) crashes Scribus if there is none

Modified:
    branches/Version14x/Scribus/scribus/editor.cpp
    branches/Version14x/Scribus/scribus/editor.h
    branches/Version14x/Scribus/scribus/selfield.cpp

Modified: branches/Version14x/Scribus/scribus/editor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19441&path=/branches/Version14x/Scribus/scribus/editor.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/editor.cpp (original)
+++ branches/Version14x/Scribus/scribus/editor.cpp Wed Aug 20 23:26:42 2014
@@ -65,7 +65,7 @@
 	clearAct = new QAction(QIcon(loadIcon("16/edit-delete.png")), tr("C&lear"), this);
 	connect(clearAct, SIGNAL(triggered()), this, SLOT(del()));
 	getFieldAct = new QAction( tr("&Get Field Names"), this);
-	connect(getFieldAct, SIGNAL(triggered()), this, SLOT(GetFieldN()));
+	connect(getFieldAct, SIGNAL(triggered()), this, SLOT(GetFieldNames()));
 	fmenu = new QMenu( tr("&File"));
 	fmenu->addAction(newAct);
 	fmenu->addAction(openAct);
@@ -116,7 +116,7 @@
 	EditTex->setTextCursor(curs);
 }
 
-void Editor::GetFieldN()
+void Editor::GetFieldNames()
 {
 	if (view != 0)
 	{

Modified: branches/Version14x/Scribus/scribus/editor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19441&path=/branches/Version14x/Scribus/scribus/editor.h
==============================================================================
--- branches/Version14x/Scribus/scribus/editor.h (original)
+++ branches/Version14x/Scribus/scribus/editor.h Wed Aug 20 23:26:42 2014
@@ -56,7 +56,7 @@
 	void del();
 	void OpenScript();
 	void SaveAs();
-	void GetFieldN();
+	void GetFieldNames();
 
 protected:
 	QVBoxLayout* EditorLayout;

Modified: branches/Version14x/Scribus/scribus/selfield.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19441&path=/branches/Version14x/Scribus/scribus/selfield.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/selfield.cpp (original)
+++ branches/Version14x/Scribus/scribus/selfield.cpp Wed Aug 20 23:26:42 2014
@@ -115,7 +115,7 @@
 
 void SelectFields::SetRetVal()
 {
-	S_Fields = "";
+	S_Fields = QString();
 	if (FTyp > 1)
 	{
 		if (SelFields->count() > 0)
@@ -123,8 +123,16 @@
 		for (int r = 1; r < SelFields->count(); ++r)
 			S_Fields += ", "+SelFields->item(r)->text();
 	}
-	else
+	else if (AvailFields->currentItem())
+	{
 		S_Fields = AvailFields->currentItem()->text();
+	}
+
+	if (S_Fields.isEmpty())
+	{
+		reject();
+		return;
+	}
 	accept();
 }
 




More information about the scribus-commit mailing list