cui/source/dialogs/scriptdlg.cxx  |    4 ++--
 sd/source/ui/view/sdview.cxx      |    2 +-
 starmath/source/unomodel.cxx      |    4 ++--
 sw/source/core/crsr/viscrs.cxx    |    2 +-
 sw/source/core/doc/docdesc.cxx    |   17 +++++++----------
 sw/source/core/text/itrform2.cxx  |   10 ++++------
 sw/source/filter/xml/xmlitmpr.cxx |    2 +-
 sw/source/ui/uiview/view2.cxx     |    3 ++-
 vcl/source/window/decoview.cxx    |    2 +-
 9 files changed, 21 insertions(+), 25 deletions(-)

New commits:
commit 5122e3413b06125ff45fd10e1ac1f0e58c24afcc
Author: Ivan Timofeev <timofeev....@gmail.com>
Date:   Sun Nov 6 13:20:56 2011 +0400

    cppcheck: avoid possible null pointer dereferences

diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 8670778..2e34358 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -623,7 +623,7 @@ sal_Bool View::IsPresObjSelected(sal_Bool bOnPage, sal_Bool 
bOnMasterPage, sal_B
         if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || 
pObj->GetUserCall() ) )
         {
             pPage = (SdPage*) pObj->GetPage();
-            bMasterPage = pPage->IsMasterPage();
+            bMasterPage = pPage && pPage->IsMasterPage();
 
             if ( (bMasterPage && bOnMasterPage) || (!bMasterPage && bOnPage) )
             {
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 4ac9297..fae2579 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -882,9 +882,9 @@ void SmModel::_getPropertyValues( const PropertyMapEntry 
**ppEntries, Any *pValu
                 for (size_t i = 0; i < aSymbols.size(); ++i)
                 {
                     const SmSym * pSymbol = aSymbols[ i ];
-                    const bool bIsUsedSymbol = rUsedSymbols.find( 
pSymbol->GetName() ) != rUsedSymbols.end();
                     if (pSymbol && !pSymbol->IsPredefined() &&
-                        (!bUsedSymbolsOnly || bIsUsedSymbol))
+                        (!bUsedSymbolsOnly ||
+                         rUsedSymbols.find( pSymbol->GetName() ) != 
rUsedSymbols.end()))
                     {
                         aVector.push_back ( pSymbol );
                         nCount++;
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 52312a0..7310b07 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -611,8 +611,9 @@ void SwDoc::PrtDataChanged()
     if ( pTmpRoot )
     {
         ViewShell *pSh = GetCurrentViewShell();
-        if( !pSh->GetViewOptions()->getBrowseMode() ||
-            pSh->GetViewOptions()->IsPrtFormat() )
+        if( pSh &&
+            (!pSh->GetViewOptions()->getBrowseMode() ||
+             pSh->GetViewOptions()->IsPrtFormat()) )
         {
             if ( GetDocShell() )
                 pWait = new SwWait( *GetDocShell(), sal_True );
@@ -632,16 +633,12 @@ void SwDoc::PrtDataChanged()
             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
             std::for_each( aAllLayouts.begin(), 
aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), 
INV_SIZE));
 
-            if ( pSh )
+            do
             {
-                do
-                {
-                    pSh->InitPrt( pPrt );
-                    pSh = (ViewShell*)pSh->GetNext();
-                }
-                while ( pSh != GetCurrentViewShell() );
+                pSh->InitPrt( pPrt );
+                pSh = (ViewShell*)pSh->GetNext();
             }
-
+            while ( pSh != GetCurrentViewShell() );
         }
     }
     if ( bDraw && pDrawModel )
diff --git a/sw/source/filter/xml/xmlitmpr.cxx 
b/sw/source/filter/xml/xmlitmpr.cxx
index 27c66e9..d61b4df 100644
--- a/sw/source/filter/xml/xmlitmpr.cxx
+++ b/sw/source/filter/xml/xmlitmpr.cxx
@@ -77,7 +77,7 @@ SvXMLItemMapEntry* SvXMLItemMapEntries::getByName(  
sal_uInt16 nNameSpace,
         pMap++;
     }
 
-    return (pMap->eLocalName != XML_TOKEN_INVALID) ? pMap : NULL;
+    return (pMap && (pMap->eLocalName != XML_TOKEN_INVALID)) ? pMap : NULL;
 }
 
 SvXMLItemMapEntry* SvXMLItemMapEntries::getByIndex( sal_uInt16 nIndex ) const
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 7b69a02..afc6093 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -2282,10 +2282,11 @@ void SwView::GenerateFormLetter(sal_Bool 
bUseCurrentDocument)
         rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer
                             // das Mischen von DB-Feldern notwendig.
         AttrChangedNotify( &rSh );
-        pNewDBMgr->SetMergeType( DBMGR_MERGE );
 
         if (pNewDBMgr)
         {
+            pNewDBMgr->SetMergeType( DBMGR_MERGE );
+
             Sequence<PropertyValue> aProperties(3);
             PropertyValue* pValues = aProperties.getArray();
             pValues[0].Name = C2U("DataSourceName");
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index ba41187..ab61741 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -786,7 +786,7 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& 
rRect,
     if ( nStyle & FRAME_DRAW_NODRAW )
     {
         sal_uInt16 nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : 
nStyle;
-        if( pWin->GetType() == WINDOW_BORDERWINDOW )
+        if( pWin && pWin->GetType() == WINDOW_BORDERWINDOW )
             nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER;
         ImplControlValue aControlValue( nValueStyle );
         Rectangle aBound, aContent;
commit 0cf754f5ca356c2d93f7ebf8523b2dc2246e4763
Author: Ivan Timofeev <timofeev....@gmail.com>
Date:   Sun Nov 6 13:16:47 2011 +0400

    cppcheck: drop redundant checks

diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 8c0a373..d7f3dd2 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -1578,8 +1578,8 @@ IMPL_LINK( SvxScriptErrorDialog, ShowDialog, 
::rtl::OUString*, pMessage )
     pBox->SetText( CUI_RES( RID_SVXSTR_ERROR_TITLE ) );
     pBox->Execute();
 
-    if ( pBox ) delete pBox;
-    if ( pMessage ) delete pMessage;
+    delete pBox;
+    delete pMessage;
 
     return 0;
 }
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 8940ed2..8c93ab5 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -694,7 +694,7 @@ void SwShellTableCrsr::FillRects()
 
         while ( pFrm )
         {
-            if( pFrm && aReg.GetOrigin().IsOver( pFrm->Frm() ) )
+            if( aReg.GetOrigin().IsOver( pFrm->Frm() ) )
                 aReg -= pFrm->Frm();
 
             pFrm = pFrm->GetNextCellLeaf( MAKEPAGE_NONE );
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index a507526..53a092c 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1011,12 +1011,10 @@ SwLinePortion 
*SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf)
             else
                 if( pPor->InNumberGrp() )
                     rInf.SetNumDone(sal_True);
-        if( pPor )
-        {
-            rInf.SetRest(0);
-            pCurr->SetRest( sal_True );
-            return pPor;
-        }
+
+        rInf.SetRest(0);
+        pCurr->SetRest( sal_True );
+        return pPor;
     }
 
     // ???? und ????: im Follow duerfen wir schon stehen,
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to