basic/source/runtime/methods.cxx |   49 +++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 25 deletions(-)

New commits:
commit 66fe1fa945a161b2f617ab3576ddef23d84148f8
Author:     Roman Kuznetsov <antilibreoff...@gmail.com>
AuthorDate: Fri Jun 3 09:11:28 2022 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jun 3 10:17:02 2022 +0200

    tdf#147132 Flatten Basic function
    
    Change-Id: Ib2646bfbebdfb6d8e8a3cd1355db75b0405ccfe6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135268
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 122e87947ee0..c6d12c3c033f 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -733,41 +733,40 @@ void SbRtl_FileLen(StarBASIC *, SbxArray & rPar, bool)
 {
     if (rPar.Count() < 2)
     {
-        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     }
-    else
+    
+    SbxVariableRef pArg = rPar.Get(1);
+    OUString aStr( pArg->GetOUString() );
+    sal_Int32 nLen = 0;
+    if( hasUno() )
     {
-        SbxVariableRef pArg = rPar.Get(1);
-        OUString aStr( pArg->GetOUString() );
-        sal_Int32 nLen = 0;
-        if( hasUno() )
+        const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = 
getFileAccess();
+        if( xSFI.is() )
         {
-            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = 
getFileAccess();
-            if( xSFI.is() )
+            try
             {
-                try
-                {
-                    nLen = xSFI->getSize( getFullPath( aStr ) );
-                }
-                catch(const Exception & )
-                {
-                    StarBASIC::Error( ERRCODE_IO_GENERAL );
-                }
+                nLen = xSFI->getSize( getFullPath( aStr ) );
+            }
+            catch(const Exception & )
+            {
+                StarBASIC::Error( ERRCODE_IO_GENERAL );
             }
         }
-        else
-        {
-            DirectoryItem aItem;
-            (void)DirectoryItem::get( getFullPath( aStr ), aItem );
-            FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
-            (void)aItem.getFileStatus( aFileStatus );
-            nLen = static_cast<sal_Int32>(aFileStatus.getFileSize());
-        }
-        rPar.Get(0)->PutLong(nLen);
     }
+    else
+    {
+        DirectoryItem aItem;
+        (void)DirectoryItem::get( getFullPath( aStr ), aItem );
+        FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
+        (void)aItem.getFileStatus( aFileStatus );
+        nLen = static_cast<sal_Int32>(aFileStatus.getFileSize());
+    }
+    rPar.Get(0)->PutLong(nLen);
 }
 
 
+
 void SbRtl_Hex(StarBASIC *, SbxArray & rPar, bool)
 {
     if (rPar.Count() < 2)

Reply via email to