r20463 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Tue Oct 13 11:12:50 UTC 2015


Author: jghali
Date: Tue Oct 13 11:12:50 2015
New Revision: 20463

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20463
Log:
#13416: Assert failure when loading document

Modified:
    branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    branches/Version14x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp

Modified: branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20463&path=/branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(original)
+++ branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	Tue Oct 13 11:12:50 2015
@@ -1556,9 +1556,12 @@
 		{
 			if (lc.value() >= 0)
 			{
-				PageItem * Its = m_Doc->DocItems.at(lc.key());
-				PageItem * Itn = m_Doc->DocItems.at(lc.value());
-				if (!Its->testLinkCandidate(Itn))
+				PageItem *Its(0), *Itn(0);
+				if (lc.key() < m_Doc->DocItems.count())
+					Its = m_Doc->DocItems.at(lc.key());
+				if (lc.value() < m_Doc->DocItems.count())
+					Itn = m_Doc->DocItems.at(lc.value());
+				if (!Its || !Itn || !Its->testLinkCandidate(Itn))
 				{
 					qDebug() << "scribus134format: corruption in linked textframes detected";
 					continue;
@@ -1575,9 +1578,12 @@
 		{
 			if (lc.value() >= 0)
 			{
-				PageItem * Its = m_Doc->MasterItems.at(lc.key());
-				PageItem * Itn = m_Doc->MasterItems.at(lc.value());
-				if (!Its->testLinkCandidate(Itn))
+				PageItem *Its(0), *Itn(0);
+				if (lc.key() < m_Doc->MasterItems.count())
+					Its = m_Doc->MasterItems.at(lc.key());
+				if (lc.value() < m_Doc->MasterItems.count())
+					Itn = m_Doc->MasterItems.at(lc.value());
+				if (!Its || !Itn || !Its->testLinkCandidate(Itn))
 				{
 					qDebug() << "scribus134format: corruption in linked textframes detected";
 					continue;
@@ -3232,9 +3238,9 @@
 					/* not sure if we want that...
 					else if (pg.tagName()=="MASTEROBJECT")
 					{
-						itemRemapM[itemCountM++] = m_Doc->MasterItems->count();
+						itemRemapM[itemCountM++] = m_Doc->MasterItems.count();
 						if (pg.attribute("NEXTITEM").toInt() != -1)
-							itemNextM[m_Doc->MasterItems->count()] = pg.attribute("NEXTITEM").toInt();
+							itemNextM[m_Doc->MasterItems.count()] = pg.attribute("NEXTITEM").toInt();
 					}
 					else if (pg.tagName()=="FRAMEOBJECT")
 					{
@@ -3401,17 +3407,17 @@
 		{
 			if (itemRemap[lc.value()] >= 0)
 			{
-				if ((lc.key() < m_Doc->Items->count()) && (itemRemap[lc.value()] < m_Doc->Items->count()))
-				{
-					PageItem * Its = m_Doc->DocItems.at(lc.key());
-					PageItem * Itn = m_Doc->DocItems.at(itemRemap[lc.value()]);
-					if (!Its->testLinkCandidate(Itn))
-					{
-						qDebug() << "scribus134format: corruption in linked textframes detected";
-						continue;
-					}
-					Its->link(Itn);
-				}
+				PageItem *Its(0), *Itn(0);
+				if (lc.key() < m_Doc->DocItems.count())
+					Its = m_Doc->DocItems.at(lc.key());
+				if (itemRemap[lc.value()] < m_Doc->DocItems.count())
+					Itn = m_Doc->DocItems.at(itemRemap[lc.value()]);
+				if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+				{
+					qDebug() << "scribus134format: corruption in linked textframes detected";
+					continue;
+				}
+				Its->link(Itn);
 			}
 		}
 	}
@@ -3422,17 +3428,17 @@
 		{
 			if (itemRemapM[lc.value()] >= 0)
 			{
-				if ((lc.key() < m_Doc->MasterItems.count()) && (itemRemapM[lc.value()] < m_Doc->MasterItems.count()))
-				{
-					PageItem * Its = m_Doc->MasterItems.at(lc.key());
-					PageItem * Itn = m_Doc->MasterItems.at(itemRemapM[lc.value()]);
-					if (!Its->testLinkCandidate(Itn))
-					{
-						qDebug() << "scribus134format: corruption in linked textframes detected";
-						continue;
-					}
-					Its->link(Itn);
-				}
+				PageItem * Its(0), *Itn(0);
+				if (lc.key() < m_Doc->MasterItems.count())
+					Its = m_Doc->MasterItems.at(lc.key());
+				if (itemRemapM[lc.value()] < m_Doc->MasterItems.count())
+					Itn = m_Doc->MasterItems.at(itemRemapM[lc.value()]);
+				if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+				{
+					qDebug() << "scribus134format: corruption in linked textframes detected";
+					continue;
+				}
+				Its->link(Itn);
 			}
 		}
 	}

Modified: branches/Version14x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20463&path=/branches/Version14x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(original)
+++ branches/Version14x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp	Tue Oct 13 11:12:50 2015
@@ -1125,9 +1125,12 @@
 		{
 			if (itemRemap[lc.value()] >= 0)
 			{
-				PageItem * Its = m_Doc->Items->at(lc.key());
-				PageItem * Itn = m_Doc->Items->at(itemRemap[lc.value()]);
-				if (!Its->testLinkCandidate(Itn))
+				PageItem *Its(0), *Itn(0);
+				if (lc.key() < m_Doc->Items->count())
+					Its = m_Doc->Items->at(lc.key());
+				if (itemRemap[lc.value()] < m_Doc->Items->count())
+					Itn = m_Doc->Items->at(itemRemap[lc.value()]);
+				if (!Its || !Itn || !Its->testLinkCandidate(Itn))
 				{
 					qDebug("scribus13format: corruption in linked textframes detected");
 					continue;
@@ -2393,17 +2396,17 @@
 		{
 			if (itemRemap[lc.value()] >= 0)
 			{
-				if ((lc.key() < m_Doc->Items->count()) && (itemRemap[lc.value()] < m_Doc->Items->count()))
-				{
-					PageItem * Its = m_Doc->Items->at(lc.key());
-					PageItem * Itn = m_Doc->Items->at(itemRemap[lc.value()]);
-					if (!Its->testLinkCandidate(Itn))
-					{
-						qDebug("scribus13format: corruption in linked textframes detected");
-						continue;
-					}
-					Its->link(Itn);
-				}
+				PageItem *Its(0), *Itn(0);
+				if (lc.key() < m_Doc->Items->count())
+					Its = m_Doc->Items->at(lc.key());
+				if (itemRemap[lc.value()] < m_Doc->Items->count())
+					Itn = m_Doc->Items->at(itemRemap[lc.value()]);
+				if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+				{
+					qDebug("scribus13format: corruption in linked textframes detected");
+					continue;
+				}
+				Its->link(Itn);
 			}
 		}
 	}	




More information about the scribus-commit mailing list