r18048 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:11:46 UTC 2013


Author: fschmid
Date: Sat Jan  5 10:11:46 2013
New Revision: 18048

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

Modified:
    branches/Version14x/Scribus/scribus/scribusdoc.cpp

Modified: branches/Version14x/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18048&path=/branches/Version14x/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribusdoc.cpp (original)
+++ branches/Version14x/Scribus/scribus/scribusdoc.cpp Sat Jan  5 10:11:46 2013
@@ -1801,6 +1801,9 @@
 	//CB We dont create master pages (yet) with a pageCount based location
 	//Page* addedPage = new Page(ScratchLeft, MasterPages.count()*(pageHeight+ScratchBottom+ScratchTop)+ScratchTop, pageWidth, pageHeight);
 	Page* addedPage = new Page(scratch.Left, scratch.Top, pageWidth, pageHeight);
+	int pgN = pageNumber;
+	if (pageNumber > MasterPages.count())
+		pgN = MasterPages.count();
 	assert(addedPage!=NULL);
 	addedPage->setDocument(this);
 	addedPage->Margins.Top = pageMargins.Top;
@@ -1816,10 +1819,10 @@
 	addedPage->marginPreset = marginPreset;
 	addedPage->MPageNam = "";
 	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();
 	return addedPage;




More information about the scribus-commit mailing list