You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2022/12/09 19:28:52 UTC
[openoffice] 02/03: More checks
This is an automated email from the ASF dual-hosted git repository.
ardovm pushed a commit to branch ppt
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 908738a448df22237df99329d2e7141e168737d9
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Fri Dec 9 17:43:46 2022 +0100
More checks
---
main/svx/source/svdraw/svdoedge.cxx | 2 +-
main/vcl/source/gdi/bmpacc.cxx | 53 ++++++++++++++++++++++---------------
2 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/main/svx/source/svdraw/svdoedge.cxx b/main/svx/source/svdraw/svdoedge.cxx
index 5bd1237c82..73f9c3f1bc 100644
--- a/main/svx/source/svdraw/svdoedge.cxx
+++ b/main/svx/source/svdraw/svdoedge.cxx
@@ -2262,7 +2262,7 @@ void SdrEdgeObj::NbcResize(const Point& rRefPnt, const Fraction& aXFact, const F
ResizeXPoly(*pEdgeTrack,rRefPnt,aXFact,aYFact);
// #75371# if resize is not from paste, forget user distances
- if(!GetModel()->IsPasteResize())
+ if(GetModel() && !GetModel()->IsPasteResize())
{
// #75735#
aEdgeInfo.aObj1Line2 = Point();
diff --git a/main/vcl/source/gdi/bmpacc.cxx b/main/vcl/source/gdi/bmpacc.cxx
index dd594425dd..49a38cc9f5 100644
--- a/main/vcl/source/gdi/bmpacc.cxx
+++ b/main/vcl/source/gdi/bmpacc.cxx
@@ -107,31 +107,40 @@ void BitmapReadAccess::ImplCreate( Bitmap& rBitmap )
const long nHeight = mpBuffer->mnHeight;
Scanline pTmpLine = mpBuffer->mpBits;
- mpScanBuf = new Scanline[ nHeight ];
- maColorMask = mpBuffer->maColorMask;
+ try {
+ mpScanBuf = new Scanline[ nHeight ];
+ } catch (std::bad_alloc &) {
+ mpScanBuf = NULL;
+ }
+ if (mpScanBuf) {
+ maColorMask = mpBuffer->maColorMask;
- if( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
- {
- for( long nY = 0L; nY < nHeight; nY++, pTmpLine += mpBuffer->mnScanlineSize )
- mpScanBuf[ nY ] = pTmpLine;
- }
- else
- {
- for( long nY = nHeight - 1; nY >= 0; nY--, pTmpLine += mpBuffer->mnScanlineSize )
- mpScanBuf[ nY ] = pTmpLine;
- }
+ if( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
+ {
+ for( long nY = 0L; nY < nHeight; nY++, pTmpLine += mpBuffer->mnScanlineSize )
+ mpScanBuf[ nY ] = pTmpLine;
+ }
+ else
+ {
+ for( long nY = nHeight - 1; nY >= 0; nY--, pTmpLine += mpBuffer->mnScanlineSize )
+ mpScanBuf[ nY ] = pTmpLine;
+ }
- if( !ImplSetAccessPointers( BMP_SCANLINE_FORMAT( mpBuffer->mnFormat ) ) )
- {
- delete[] mpScanBuf;
- mpScanBuf = NULL;
+ if( !ImplSetAccessPointers( BMP_SCANLINE_FORMAT( mpBuffer->mnFormat ) ) )
+ {
+ delete[] mpScanBuf;
+ mpScanBuf = NULL;
- pImpBmp->ImplReleaseBuffer( mpBuffer, !mbModify );
- mpBuffer = NULL;
- }
- else
- maBitmap = rBitmap;
- }
+ pImpBmp->ImplReleaseBuffer( mpBuffer, !mbModify );
+ mpBuffer = NULL;
+ }
+ else
+ maBitmap = rBitmap;
+ } else {
+ pImpBmp->ImplReleaseBuffer( mpBuffer, !mbModify );
+ mpBuffer = NULL;
+ }
+ }
}
}