Kaydet (Commit) 51e2d235 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1267681 Dereference before null check

Change-Id: I629b12d53ef3bbadeb43e9555a8499252c1a1800
üst 1479190c
...@@ -348,14 +348,14 @@ inline Scanline BitmapReadAccess::GetBuffer() const ...@@ -348,14 +348,14 @@ inline Scanline BitmapReadAccess::GetBuffer() const
inline Scanline BitmapReadAccess::GetScanline( long nY ) const inline Scanline BitmapReadAccess::GetScanline( long nY ) const
{ {
assert(mpBuffer && "Access is not valid!"); assert(mpBuffer && mpScanBuf && "Access is not valid!");
assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!"); assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
return( mpBuffer ? mpScanBuf[ nY ] : NULL ); return mpScanBuf[nY];
} }
inline BitmapColor BitmapReadAccess::GetPixel( long nY, long nX ) const inline BitmapColor BitmapReadAccess::GetPixel( long nY, long nX ) const
{ {
assert(mpBuffer && "Access is not valid!"); assert(mpBuffer && mpScanBuf && "Access is not valid!");
assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!"); assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!");
assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!"); assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
return mFncGetPixel( mpScanBuf[ nY ], nX, maColorMask ); return mFncGetPixel( mpScanBuf[ nY ], nX, maColorMask );
......
...@@ -426,7 +426,7 @@ BitmapWriteAccess::~BitmapWriteAccess() ...@@ -426,7 +426,7 @@ BitmapWriteAccess::~BitmapWriteAccess()
void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc ) void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc )
{ {
DBG_ASSERT( ( nY >= 0 ) && ( nY < mpBuffer->mnHeight ), "y-coordinate in destination out of range!" ); assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!");
DBG_ASSERT( nY < rReadAcc.Height(), "y-coordinate in source out of range!" ); DBG_ASSERT( nY < rReadAcc.Height(), "y-coordinate in source out of range!" );
DBG_ASSERT( ( HasPalette() && rReadAcc.HasPalette() ) || ( !HasPalette() && !rReadAcc.HasPalette() ), "No copying possible between palette bitmap and TC bitmap!" ); DBG_ASSERT( ( HasPalette() && rReadAcc.HasPalette() ) || ( !HasPalette() && !rReadAcc.HasPalette() ), "No copying possible between palette bitmap and TC bitmap!" );
...@@ -446,7 +446,7 @@ void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline, ...@@ -446,7 +446,7 @@ void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline,
{ {
const sal_uLong nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat ); const sal_uLong nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat );
DBG_ASSERT( ( nY >= 0 ) && ( nY < mpBuffer->mnHeight ), "y-coordinate in destination out of range!" ); assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!");
DBG_ASSERT( ( HasPalette() && nFormat <= BMP_FORMAT_8BIT_PAL ) || DBG_ASSERT( ( HasPalette() && nFormat <= BMP_FORMAT_8BIT_PAL ) ||
( !HasPalette() && nFormat > BMP_FORMAT_8BIT_PAL ), ( !HasPalette() && nFormat > BMP_FORMAT_8BIT_PAL ),
"No copying possible between palette and non palette scanlines!" ); "No copying possible between palette and non palette scanlines!" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment