r18049 by fschmid - Fixed Bug #10749: Crashes due to signal 11 when opening file

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 5 10:13:09 UTC 2013


Author: fschmid
Date: Sat Jan  5 10:13:09 2013
New Revision: 18049

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18049
Log:
Fixed Bug #10749: Crashes due to signal 11 when opening file

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18049&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Jan  5 10:13:09 2013
@@ -2630,11 +2630,14 @@
 	addedPage->setOrientation(docPrefsData.docSetupPrefs.pageOrientation);
 	addedPage->marginPreset = docPrefsData.docSetupPrefs.marginPreset;
 	addedPage->MPageNam = "";
+	int pgN = pageNumber;
+	if (pageNumber > MasterPages.count())
+		pgN = MasterPages.count();
 	addedPage->setPageName(pageName);
-	addedPage->setPageNr(pageNumber);
-	MasterNames.insert(pageName, pageNumber);
-	MasterPages.insert(pageNumber, addedPage);
-	assert(MasterPages.at(pageNumber)!=NULL);
+	addedPage->setPageNr(pgN);
+	MasterNames.insert(pageName, pgN);
+	MasterPages.insert(pgN, addedPage);
+	assert(MasterPages.at(pgN)!=NULL);
 	if  (!isLoading())
 		changed();
 	if(UndoManager::undoEnabled())
@@ -2642,7 +2645,7 @@
 		SimpleState *ss = new SimpleState(Um::NewMasterPage, "", Um::IDocument);
 		ss->set("MASTERPAGE_ADD", "masterpage_add");
 		ss->set("MASTERPAGE_NAME", pageName);
-		ss->set("MASTERPAGE_NBR", pageNumber);
+		ss->set("MASTERPAGE_NBR", pgN);
 		undoManager->action(this, ss);
 	}
 	return addedPage;




More information about the scribus-commit mailing list