diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-08-05 09:45:55 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-08-10 22:03:34 +0200 |
commit | f18b7955344c058db8b021f77fe9a5b99592dc54 (patch) | |
tree | a1aedd2ec786a8d0ebd4e084761e71d1e69b6932 /sd | |
parent | 266c73ebd350a161be9b73715673c0b85e499ac4 (diff) |
Avoid getTokenCount
Change-Id: Ib1b6c354184b9379ebafb15ac4a1c789e1c3c1a2
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/dlg/tpoption.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index 53c4487681fb..b77e2949b2a7 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -587,10 +587,15 @@ OUString SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY ) bool SdTpOptionsMisc::SetScale( const OUString& aScale, sal_Int32& rX, sal_Int32& rY ) { - if( comphelper::string::getTokenCount(aScale, TOKEN) != 2 ) + if (aScale.isEmpty()) return false; - OUString aTmp(aScale.getToken(0, TOKEN)); + sal_Int32 nIdx {0}; + + OUString aTmp(aScale.getToken(0, TOKEN, nIdx)); + if (nIdx<0) + return false; // we expect another token! + if (!comphelper::string::isdigitAsciiString(aTmp)) return false; @@ -598,7 +603,10 @@ bool SdTpOptionsMisc::SetScale( const OUString& aScale, sal_Int32& rX, sal_Int32 if( rX == 0 ) return false; - aTmp = aScale.getToken(1, TOKEN); + aTmp = aScale.getToken(0, TOKEN, nIdx); + if (nIdx>=0) + return false; // we require just 2 tokens! + if (!comphelper::string::isdigitAsciiString(aTmp)) return false; |