diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-12-23 20:45:29 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-12-23 20:47:23 +0000 |
commit | f244b3120ef7bf183186bcf02cf4a9c4ab4faed7 (patch) | |
tree | d53e520a27bf066558b6495eef314abb25fa1f0c /sc | |
parent | e225b0925b371bd33d40d97c240bd3165b628464 (diff) |
coverity#1260301 Using invalid iterator
Change-Id: Id3ea2c99026a2d3fea4509b091aa3e352855bc0e
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/unitconverter.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/unitconverter.cxx | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/filter/inc/unitconverter.hxx b/sc/source/filter/inc/unitconverter.hxx index 1f139450ffe0..6cb49b211eed 100644 --- a/sc/source/filter/inc/unitconverter.hxx +++ b/sc/source/filter/inc/unitconverter.hxx @@ -87,7 +87,7 @@ public: sal_uInt8 calcBiffErrorCode( const OUString& rErrorCode ) const; /** Returns an error string from the passed BIFF error code. */ - const OUString& calcErrorString( sal_uInt8 nErrorCode ) const; + OUString calcErrorString( sal_uInt8 nErrorCode ) const; private: /** Adds an error code to the internal maps. */ diff --git a/sc/source/filter/oox/unitconverter.cxx b/sc/source/filter/oox/unitconverter.cxx index 55f2f4512289..eae62818f58b 100644 --- a/sc/source/filter/oox/unitconverter.cxx +++ b/sc/source/filter/oox/unitconverter.cxx @@ -218,7 +218,7 @@ sal_uInt8 UnitConverter::calcBiffErrorCode( const OUString& rErrorCode ) const return (aIt == maOoxErrCodes.end()) ? BIFF_ERR_NA : aIt->second; } -const OUString& UnitConverter::calcErrorString( sal_uInt8 nErrorCode ) const +OUString UnitConverter::calcErrorString( sal_uInt8 nErrorCode ) const { OoxErrorCodeMap::const_iterator iFail( maOoxErrCodes.end()); for (OoxErrorCodeMap::const_iterator aIt( maOoxErrCodes.begin()); aIt != maOoxErrCodes.end(); ++aIt) @@ -229,7 +229,7 @@ const OUString& UnitConverter::calcErrorString( sal_uInt8 nErrorCode ) const iFail = aIt; } assert(iFail != maOoxErrCodes.end()); // BIFF_ERR_NA really should be in the map.. - return iFail->first; + return iFail != maOoxErrCodes.end() ? iFail->first : OUString(); } void UnitConverter::addErrorCode( sal_uInt8 nErrorCode, const OUString& rErrorCode ) |