[Libreoffice] [PATCH] Replace List for vector<> in sc
Petr Mladek
pmladek at suse.cz
Wed Jun 8 03:36:17 PDT 2011
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
More information about the LibreOffice
mailing list