summaryrefslogtreecommitdiff
path: root/comphelper/source/eventattachermgr
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-01-27 15:14:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-01-27 15:23:17 +0000
commit7677c52ae102f471c5504d5276dff6480ab6cdf0 (patch)
tree543d10900ca7b9cc50e187b5760568795442d51f /comphelper/source/eventattachermgr
parent8bb41c67f0d3b5773fd14153d3489e59d6848a05 (diff)
coverity#705787 Dereference before null check
Change-Id: I4d6e4ddaa104a025349c55ab75263004a6b2b6bf
Diffstat (limited to 'comphelper/source/eventattachermgr')
-rw-r--r--comphelper/source/eventattachermgr/eventattachermgr.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 53a115dcec7c..99b25a9f86e6 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -464,10 +464,9 @@ void SAL_CALL ImplEventAttacherManager::registerScriptEvent
::std::deque< AttachedObject_Impl > aList = (*aIt).aObjList;
ScriptEventDescriptor aEvt = ScriptEvent;
- const sal_Unicode* pLastDot = aEvt.ListenerType.getStr();
- pLastDot += rtl_ustr_lastIndexOfChar( pLastDot, '.' );
- if( pLastDot )
- aEvt.ListenerType = pLastDot +1;
+ sal_Int32 nLastDot = aEvt.ListenerType.lastIndexOf('.');
+ if (nLastDot != -1)
+ aEvt.ListenerType = aEvt.ListenerType.copy(nLastDot+1);
(*aIt).aEventList.push_back( aEvt );
// register new new Event
@@ -538,10 +537,9 @@ void SAL_CALL ImplEventAttacherManager::revokeScriptEvent
::std::for_each(aList.begin(), aList.end(), DetachObject(*this, nIndex));
OUString aLstType = ListenerType;
- const sal_Unicode * pLastDot = aLstType.getStr();
- pLastDot += rtl_ustr_lastIndexOfChar( pLastDot, '.' );
- if( pLastDot )
- aLstType = pLastDot +1;
+ sal_Int32 nLastDot = aLstType.lastIndexOf('.');
+ if (nLastDot != -1)
+ aLstType = aLstType.copy(nLastDot+1);
::std::deque< ScriptEventDescriptor >::iterator aEvtIt = (*aIt).aEventList.begin();
::std::deque< ScriptEventDescriptor >::iterator aEvtEnd = (*aIt).aEventList.end();