diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-28 12:07:57 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-28 15:06:33 +0000 |
commit | d1f00da63c3b63bf02b7cf2380b2809a3010ec12 (patch) | |
tree | 260faaa6bfaff4b697973868b8de5d5d88bb47da | |
parent | 98b83c6a292c184f69b55e114c30212591884d0a (diff) |
coverity#704072 Unchecked return value
Change-Id: I3bd198fc21bb414a0b80e8234e22782e24e0477e
-rw-r--r-- | sw/source/uibase/lingu/olmenu.cxx | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index ce080774ed7a..2c1b0bb53b33 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -748,44 +748,46 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) { } } else { - linguistic::AddEntryToDic( xDictionary, - m_xSpellAlt->getWord(), false, OUString(), LANGUAGE_NONE ); + OUString sWord(m_xSpellAlt->getWord()); + sal_Int16 nAddRes = linguistic::AddEntryToDic( xDictionary, + sWord, false, OUString(), LANGUAGE_NONE ); + if (DIC_ERR_NONE != nAddRes && !xDictionary->getEntry(sWord).is()) + { + SvxDicError(&m_pSh->GetView().GetViewFrame()->GetWindow(), nAddRes); + } } } else if ((MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) || nId == MN_ADD_TO_DIC_SINGLE) { - OUString aWord( m_xSpellAlt->getWord() ); - OUString aDicName; + OUString sWord( m_xSpellAlt->getWord() ); + OUString aDicName; - if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) - { - PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC); - aDicName = pMenu->GetItemText(nId); - } - else - aDicName = m_aDicNameSingle; + if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) + { + PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC); + aDicName = pMenu->GetItemText(nId); + } + else + aDicName = m_aDicNameSingle; - uno::Reference< linguistic2::XDictionary > xDic; - uno::Reference< linguistic2::XSearchableDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - xDic = xDicList->getDictionaryByName( aDicName ); + uno::Reference< linguistic2::XDictionary > xDic; + uno::Reference< linguistic2::XSearchableDictionaryList > xDicList( SvxGetDictionaryList() ); + if (xDicList.is()) + xDic = xDicList->getDictionaryByName( aDicName ); - if (xDic.is()) + if (xDic.is()) + { + sal_Int16 nAddRes = linguistic::AddEntryToDic(xDic, sWord, false, OUString(), LANGUAGE_NONE); + // save modified user-dictionary if it is persistent + uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); + if (xSavDic.is()) + xSavDic->store(); + + if (DIC_ERR_NONE != nAddRes && !xDic->getEntry(sWord).is()) { - sal_Int16 nAddRes = linguistic::AddEntryToDic( xDic, aWord, false, OUString(), LANGUAGE_NONE ); - // save modified user-dictionary if it is persistent - uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); - if (xSavDic.is()) - xSavDic->store(); - - if (DIC_ERR_NONE != nAddRes - && !xDic->getEntry( aWord ).is()) - { - SvxDicError( - &m_pSh->GetView().GetViewFrame()->GetWindow(), - nAddRes ); - } + SvxDicError(&m_pSh->GetView().GetViewFrame()->GetWindow(), nAddRes); } + } } else if ( nId == MN_EXPLANATION_LINK && !m_sExplanationLink.isEmpty() ) { |