[Libreoffice-commits] core.git: 2 commits - basic/source

Thomas Arnhold thomas at arnhold.org
Tue May 13 04:25:48 PDT 2014


 basic/source/sbx/sbxdec.cxx |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 375a6c7a909573cea64aacd64d2a14236a371ba2
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Tue May 13 13:24:59 2014 +0200

    i#64348 basic: fix CDec() crash if string is empty
    
    This time without memory leak.
    
    Change-Id: If4474004124b7497b8451030a13db36887ead737

diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 59f5e01..ba2fc8a 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -194,6 +194,8 @@ void SbxDecimal::setUInt( unsigned int val )
 
 bool SbxDecimal::setString( OUString* pOUString )
 {
+    assert(pOUString);
+
     static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
 
     // Convert delimiter
@@ -471,7 +473,9 @@ start:
         case SbxLPSTR:
         case SbxSTRING:
         case SbxBYREF | SbxSTRING:
-            pnDecRes->setString( p->pOUString ); break;
+            if ( p->pOUString )
+                pnDecRes->setString( p->pOUString );
+            break;
         case SbxOBJECT:
         {
             SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
commit 3beaccc09dfedc560d171dbbf26f2592e046d903
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Tue May 13 13:22:04 2014 +0200

    Revert "i#64348 basic: fix CDec() crash if string is empty"
    
    This reverts commit 375b01bf747bb206c3fd6bad0acbd38271a8fb86.

diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index f0cab34..59f5e01 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -194,8 +194,6 @@ void SbxDecimal::setUInt( unsigned int val )
 
 bool SbxDecimal::setString( OUString* pOUString )
 {
-    assert(pOUString);
-
     static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
 
     // Convert delimiter
@@ -473,11 +471,7 @@ start:
         case SbxLPSTR:
         case SbxSTRING:
         case SbxBYREF | SbxSTRING:
-            if( !p->pOUString )
-                pnDecRes->setString( new OUString );
-            else
-                pnDecRes->setString( p->pOUString );
-            break;
+            pnDecRes->setString( p->pOUString ); break;
         case SbxOBJECT:
         {
             SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);


More information about the Libreoffice-commits mailing list