[Libreoffice-commits] core.git: basctl/source

Norbert Thiebaud nthiebaud at gmail.com
Thu Feb 21 23:42:47 PST 2013


 basctl/source/basicide/bastype3.cxx |   64 ++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 34 deletions(-)

New commits:
commit bb82f5c1e946333781779cd21ab64aa19f02cd85
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Feb 18 02:12:13 2013 -0600

    coverity#982443 Explicitt null dereferenced
    
    Change-Id: I470c34c38eda673e6663b23cdb28ea4be0bef914
    Reviewed-on: https://gerrit.libreoffice.org/2218
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index db15a6a..c734642 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -208,49 +208,45 @@ SbxVariable* TreeListBox::FindVariable( SvTreeListEntry* pEntry )
 
             switch ( pBE->GetType() )
             {
-                case OBJ_TYPE_LIBRARY:
-                {
-                    if (BasicManager* pBasMgr = aDocument.getBasicManager())
-                        pVar = pBasMgr->GetLib( aName );
-                }
+            case OBJ_TYPE_LIBRARY:
+                if (BasicManager* pBasMgr = aDocument.getBasicManager())
+                    pVar = pBasMgr->GetLib( aName );
                 break;
-                case OBJ_TYPE_MODULE:
+            case OBJ_TYPE_MODULE:
+                DBG_ASSERT(dynamic_cast<StarBASIC*>(pVar), "FindVariable: invalid Basic");
+                if(!pVar)
                 {
-                    DBG_ASSERT(dynamic_cast<StarBASIC*>(pVar), "FindVariable: invalid Basic");
-                    // extract the module name from the string like "Sheet1 (Example1)"
-                    if( bDocumentObjects )
-                    {
-                        sal_uInt16 nIndex = 0;
-                        aName = aName.GetToken( 0, ' ', nIndex );
-                    }
-                    pVar = static_cast<StarBASIC*>(pVar)->FindModule( aName );
+                    break;
                 }
-                break;
-                case OBJ_TYPE_METHOD:
+                // extract the module name from the string like "Sheet1 (Example1)"
+                if( bDocumentObjects )
                 {
-                    DBG_ASSERT(dynamic_cast<SbxObject*>(pVar), "FindVariable: invalid modul/object");
-                    pVar = static_cast<SbxObject*>(pVar)->GetMethods()->Find(aName, SbxCLASS_METHOD);
+                    sal_uInt16 nIndex = 0;
+                    aName = aName.GetToken( 0, ' ', nIndex );
                 }
+                pVar = static_cast<StarBASIC*>(pVar)->FindModule( aName );
                 break;
-                case OBJ_TYPE_DIALOG:
+            case OBJ_TYPE_METHOD:
+                DBG_ASSERT(dynamic_cast<SbxObject*>(pVar), "FindVariable: invalid modul/object");
+                if(!pVar)
                 {
-                    // sbx dialogs removed
+                    break;
                 }
+                pVar = static_cast<SbxObject*>(pVar)->GetMethods()->Find(aName, SbxCLASS_METHOD);
                 break;
-                case OBJ_TYPE_DOCUMENT_OBJECTS:
-                    bDocumentObjects = true;
-                case OBJ_TYPE_USERFORMS:
-                case OBJ_TYPE_NORMAL_MODULES:
-                case OBJ_TYPE_CLASS_MODULES:
-                {
-                    // skip, to find the child entry.
-                    continue;
-                }
-                default:
-                {
-                    OSL_FAIL( "FindVariable: Unbekannter Typ!" );
-                    pVar = 0;
-                }
+            case OBJ_TYPE_DIALOG:
+                // sbx dialogs removed
+                break;
+            case OBJ_TYPE_DOCUMENT_OBJECTS:
+                bDocumentObjects = true;
+            case OBJ_TYPE_USERFORMS:
+            case OBJ_TYPE_NORMAL_MODULES:
+            case OBJ_TYPE_CLASS_MODULES:
+                // skip, to find the child entry.
+                continue;
+            default:
+                OSL_FAIL( "FindVariable: Unbekannter Typ!" );
+                pVar = 0;
                 break;
             }
             if ( !pVar )


More information about the Libreoffice-commits mailing list