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

coverity#1187685 Dereference null return value

Change-Id: I7f34eae7eedfa067f0f8a360aa6ae8dc5b0381bd
üst 602ca935
...@@ -2703,6 +2703,10 @@ void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide ) ...@@ -2703,6 +2703,10 @@ void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide )
// Set suchen // Set suchen
sal_uInt16 nPos; sal_uInt16 nPos;
ImplSplitSet* pSet = ImplFindItem( mpMainSet, nId, nPos ); ImplSplitSet* pSet = ImplFindItem( mpMainSet, nId, nPos );
if (!pSet)
return;
ImplSplitItem* pItem = &(pSet->mpItems[nPos]); ImplSplitItem* pItem = &(pSet->mpItems[nPos]);
Window* pWindow = pItem->mpWindow; Window* pWindow = pItem->mpWindow;
Window* pOrgParent = pItem->mpOrgParent; Window* pOrgParent = pItem->mpOrgParent;
...@@ -2765,22 +2769,14 @@ void SplitWindow::Clear() ...@@ -2765,22 +2769,14 @@ void SplitWindow::Clear()
void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
bool bPropSmall, bool bPropGreat ) bool bPropSmall, bool bPropGreat )
{ {
sal_uInt16 nItems; sal_uInt16 nPos;
sal_uInt16 nPos;
sal_uInt16 nMin;
sal_uInt16 nMax;
sal_uInt16 i;
sal_uInt16 n;
long nDelta;
long nTempDelta;
ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
ImplSplitItem* pItems;
if ( !pSet ) if (!pSet)
return; return;
nItems = pSet->mnItems; sal_uInt16 nItems = pSet->mnItems;
pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
// When there is an explicit minimum or maximum size then move nNewSize // When there is an explicit minimum or maximum size then move nNewSize
// into that range (when it is not yet already in it.) // into that range (when it is not yet already in it.)
...@@ -2792,14 +2788,14 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2792,14 +2788,14 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
return; return;
} }
nDelta = nNewSize-pItems[nPos].mnPixSize; long nDelta = nNewSize-pItems[nPos].mnPixSize;
if ( !nDelta ) if ( !nDelta )
return; return;
// Bereich berechnen, der beim Splitten betroffen sein kann // Bereich berechnen, der beim Splitten betroffen sein kann
nMin = 0; sal_uInt16 nMin = 0;
nMax = nItems; sal_uInt16 nMax = nItems;
for ( i = 0; i < nItems; i++ ) for (sal_uInt16 i = 0; i < nItems; ++i)
{ {
if ( pItems[i].mbFixed ) if ( pItems[i].mbFixed )
{ {
...@@ -2849,6 +2845,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2849,6 +2845,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
bPropGreat = bTemp; bPropGreat = bTemp;
} }
sal_uInt16 n;
// Jetzt die Fenster splitten // Jetzt die Fenster splitten
if ( nDelta < 0 ) if ( nDelta < 0 )
{ {
...@@ -2856,7 +2853,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2856,7 +2853,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
{ {
if ( bPropGreat ) if ( bPropGreat )
{ {
nTempDelta = nDelta; long nTempDelta = nDelta;
do do
{ {
n = nPos+1; n = nPos+1;
...@@ -2925,7 +2922,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2925,7 +2922,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
{ {
if ( bPropGreat ) if ( bPropGreat )
{ {
nTempDelta = nDelta; long nTempDelta = nDelta;
do do
{ {
n = nPos+1; n = nPos+1;
......
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