This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 24b07285b4e2b5678df8bf62004ea23ccec5c7ef
Author: Arrigo Marchiori <[email protected]>
AuthorDate: Thu Apr 15 21:19:11 2021 +0200

    Get the version string right independently from its length
    
    (cherry picked from commit 2bb5117116b35a13dabd10c558487fd8ffa33b39)
---
 main/cui/source/dialogs/about.cxx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/main/cui/source/dialogs/about.cxx 
b/main/cui/source/dialogs/about.cxx
index 150eb6e..ddfc45a 100644
--- a/main/cui/source/dialogs/about.cxx
+++ b/main/cui/source/dialogs/about.cxx
@@ -499,13 +499,14 @@ const rtl::OUString AboutDialog::GetBuildId() const
     // For better readability, strip the duplicate ProductMajor ("340").
     if ( sProductSource.getLength() )
     {
+        sal_Int32 versionLength = sProductSource.getLength() - 3;
         bool bMatchingUPD =
                 ( sProductSource.getLength() >= 3 )
-            &&  ( sBuildId.getLength() >= 3 )
-            &&  ( sProductSource.copy( sProductSource.getLength() - 4 ) == 
sBuildId.copy( 0, 4 ) );
+            &&  ( sBuildId.getLength() >= versionLength )
+            &&  ( sProductSource.copy( 3 ) == sBuildId.copy( 0, versionLength 
) );
         OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in 
their UPD" );
         if ( bMatchingUPD )
-            sProductSource = sProductSource.copy( 0, 
sProductSource.getLength() - 4 );
+            sProductSource = sProductSource.copy( 0, 
sProductSource.getLength() - versionLength );
 
         // prepend the product source
         sBuildIdBuff.insert( 0, sProductSource );

Reply via email to