From 08a8fb1acd407bab34aa3bb829c00d238f549518 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 9 Jun 2008 14:03:59 +0000 Subject: [PATCH] INTEGRATION: CWS impress141 (1.5.8); FILE MERGED 2008/04/28 16:03:20 cl 1.5.8.1: #155614# fix possible null pointer access --- canvas/source/tools/surface.cxx | 34 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/canvas/source/tools/surface.cxx b/canvas/source/tools/surface.cxx index 307bf0b84ece..1dd902d7c3ad 100644 --- a/canvas/source/tools/surface.cxx +++ b/canvas/source/tools/surface.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: surface.cxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.6 $ * * This file is part of OpenOffice.org. * @@ -82,7 +82,9 @@ namespace canvas basegfx::B2DRectangle Surface::getUVCoords() const { ::basegfx::B2ISize aPageSize(mpPageManager->getPageSize()); - ::basegfx::B2IPoint aDestOffset(mpFragment->getPos()); + ::basegfx::B2IPoint aDestOffset; + if( mpFragment ) + aDestOffset = mpFragment->getPos(); const double pw( aPageSize.getX() ); const double ph( aPageSize.getY() ); @@ -258,7 +260,9 @@ namespace canvas if(aSize.getX() <= 0 || aSize.getY() <= 0) return true; - ::basegfx::B2IPoint aDestOffset(mpFragment->getPos()); + ::basegfx::B2IPoint aDestOffset; + if( mpFragment ) + mpFragment->getPos(); // convert size to normalized device coordinates const ::basegfx::B2DRectangle& rUV( @@ -468,18 +472,24 @@ namespace canvas if(!(mpFragment)) { mpFragment = mpPageManager->allocateSpace(maSize); - mpFragment->setColorBuffer(mpColorBuffer); - mpFragment->setSourceOffset(maSourceOffset); + if( mpFragment ) + { + mpFragment->setColorBuffer(mpColorBuffer); + mpFragment->setSourceOffset(maSourceOffset); + } } - // now we need to 'select' the fragment, which will in turn - // pull informations from the image on demand. - // in case this fragment is still not located on any of the - // available pages ['naked'], we force the page manager to - // do it now, no way to defer this any longer... - if(!(mpFragment->select(mbIsDirty))) - mpPageManager->nakedFragment(mpFragment); + if( mpFragment ) + { + // now we need to 'select' the fragment, which will in turn + // pull informations from the image on demand. + // in case this fragment is still not located on any of the + // available pages ['naked'], we force the page manager to + // do it now, no way to defer this any longer... + if(!(mpFragment->select(mbIsDirty))) + mpPageManager->nakedFragment(mpFragment); + } mbIsDirty=false; }