[Libreoffice-commits] core.git: sc/source
Caolán McNamara
caolanm at redhat.com
Tue Dec 23 12:47:57 PST 2014
sc/source/filter/inc/unitconverter.hxx | 2 +-
sc/source/filter/oox/unitconverter.cxx | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit f244b3120ef7bf183186bcf02cf4a9c4ab4faed7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Dec 23 20:45:29 2014 +0000
coverity#1260301 Using invalid iterator
Change-Id: Id3ea2c99026a2d3fea4509b091aa3e352855bc0e
diff --git a/sc/source/filter/inc/unitconverter.hxx b/sc/source/filter/inc/unitconverter.hxx
index 1f13945..6cb49b2 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 55f2f45..eae6281 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 )
More information about the Libreoffice-commits
mailing list