summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-02-18 02:12:13 -0600
committerNorbert Thiebaud <nthiebaud@gmail.com>2013-02-22 07:42:27 +0000
commitbb82f5c1e946333781779cd21ab64aa19f02cd85 (patch)
tree0b20afef087419ff0911428b04fbe59b547359b5 /basctl
parent13ed66c9ce46d7f9ec9f670544e6fdf440412c72 (diff)
coverity#982443 Explicitt null dereferenced
Change-Id: I470c34c38eda673e6663b23cdb28ea4be0bef914 Reviewed-on: https://gerrit.libreoffice.org/2218 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/bastype3.cxx64
1 files changed, 30 insertions, 34 deletions
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index db15a6a6787e..c734642ddc26 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 )