r22299 by craig -

scribus-commit scribus-commit at lists.scribus.net
Fri Dec 29 22:15:10 UTC 2017


Author: craig
Date: Fri Dec 29 22:15:10 2017
New Revision: 22299

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22299
Log:
Fix Coverity 1350550 / 1350551

Modified:
    trunk/Scribus/scribus/guidemanagercore.cpp

Modified: trunk/Scribus/scribus/guidemanagercore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22299&path=/trunk/Scribus/scribus/guidemanagercore.cpp
==============================================================================
--- trunk/Scribus/scribus/guidemanagercore.cpp	(original)
+++ trunk/Scribus/scribus/guidemanagercore.cpp	Fri Dec 29 22:15:10 2017
@@ -241,20 +241,17 @@
 Guides GuideManagerCore::getAutoHorizontals(ScPage* page)
 {
 	Guides guides;
-	double rowSize;
 	int value = m_horizontalAutoCount;
-	double offset = 0.0;
-	double newPageHeight = page->height();
-
+	double newPageHeight = (page == NULL) ? 0.0 : page->height();
 	if (page == NULL)
 		page = m_page;
 	if (page == NULL)
 		return guides;
-
 	if (m_horizontalAutoCount == 0)
 		return guides;
 	++value;
 
+	double offset = 0.0;
 	if (m_horizontalAutoRefer == 1)
 	{
 		newPageHeight = newPageHeight - page->Margins.top() - page->Margins.bottom();
@@ -268,7 +265,7 @@
 			newPageHeight = page->guides.gh;
 		}
 	}
-
+	double rowSize;
 	if (page->guides.horizontalAutoGap() > 0.0)
 		rowSize = (newPageHeight - (value - 1) * page->guides.horizontalAutoGap()) / value;
 	else
@@ -291,20 +288,17 @@
 Guides GuideManagerCore::getAutoVerticals(ScPage* page)
 {
 	Guides guides;
-	double columnSize;
 	int value = m_verticalAutoCount;
-	double offset = 0.0;
-	double newPageWidth = page->width();
-
+	double newPageWidth = (page == NULL) ? 0.0 : page->width();
 	if (page == NULL)
 		page = m_page;
 	if (page == NULL)
 		return guides;
-
 	if (m_verticalAutoCount == 0)
 		return guides;
 	++value;
 
+	double offset = 0.0;
 	if (m_verticalAutoRefer == 1)
 	{
 		newPageWidth = newPageWidth - page->Margins.left() - page->Margins.right();
@@ -318,7 +312,7 @@
 			newPageWidth = page->guides.gw;
 		}
 	}
-
+	double columnSize;
 	if (page->guides.verticalAutoGap() > 0.0)
 		columnSize = (newPageWidth - (value - 1) * page->guides.verticalAutoGap()) / value;
 	else




More information about the scribus-commit mailing list