r23760 by jghali - Fix coverity 1426981: Dereference after null check

scribus-commit scribus-commit at lists.scribus.net
Mon May 11 12:37:56 UTC 2020


Author: jghali
Date: Mon May 11 12:37:56 2020
New Revision: 23760

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23760
Log:
Fix coverity 1426981: Dereference after null check

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23760&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Mon May 11 12:37:56 2020
@@ -9852,9 +9852,10 @@
 	try
 	{
 		PoDoFo::PdfPage*   page      = doc->GetPage(qMin(qMax(1, c->pixm.imgInfo.actualPageNumber), c->pixm.imgInfo.numberOfPages) - 1);
-		PoDoFo::PdfObject* contents  = page? page->GetContents() : nullptr;
-		PoDoFo::PdfObject* resources = page? page->GetResources() : nullptr;
-		for (PoDoFo::PdfObject* par = page->GetObject(); par && !resources; par = par->GetIndirectKey("Parent"))
+		PoDoFo::PdfObject* pageObj   = page ? page->GetObject() : nullptr;
+		PoDoFo::PdfObject* contents  = page ? page->GetContents() : nullptr;
+		PoDoFo::PdfObject* resources = page ? page->GetResources() : nullptr;
+		for (PoDoFo::PdfObject* par = pageObj; par && !resources; par = par->GetIndirectKey("Parent"))
 		{
 			resources = par->GetIndirectKey("Resources");
 		}




More information about the scribus-commit mailing list