Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Rafael Dominguez píše v Út 07. 06. 2011 v 20:21 -0430:
Fix adding NULL objects to ExcEScenarioManager.

Ah, this was too paranoid ;-)

--- cut ---
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1328,11 +1328,16 @@ ExcEScenarioManager::ExcEScenarioManager( const
XclExpRoot& rRoot, SCTAB nTab )
 
     while( rDoc.IsScenario( nNewTab ) )
     {
-        aScenes.push_back( new ExcEScenario( rRoot, nNewTab ) );
+        ExcEScenario *scene = new ExcEScenario( rRoot, nNewTab );
 
-        if( rDoc.IsActiveScenario( nNewTab ) )
-            nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
-        nNewTab++;
+        if (scene)
+        {
+            aScenes.push_back( scene );
+
+            if( rDoc.IsActiveScenario( nNewTab ) )
+                nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
+            nNewTab++;
+        }
     }
 }
--- cut ---

IMHO, the "new" operand could fail only when there is not enough memory
or when it throws an exception. It always returns a pointer otherwise =>
there is not needed to check for the NULL pointer => the change is not
needed.


Best Regards,
Petr


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.