resize vector in advance

Obtaining front() from an empty vector is disallowed, even if size was
reserved. So resize it.

Change-Id: Iae2aafd6b7b725ea36bf9c3fb0a2370c7037777f
This commit is contained in:
Eike Rathke
2014-04-08 11:51:19 +02:00
parent 5bce64e475
commit d114939dab

View File

@@ -375,9 +375,10 @@ void ImportExcel8::Feat( void )
{
sal_uInt32 nCbSD = aIn.ReaduInt32();
// TODO: could here be some sanity check applied to not allocate 4GB?
aProt.maSecurityDescriptor.reserve( nCbSD);
aProt.maSecurityDescriptor.resize( nCbSD);
sal_Size nRead = aIn.Read( &aProt.maSecurityDescriptor.front(), nCbSD);
aProt.maSecurityDescriptor.resize( nRead);
if (nRead < nCbSD)
aProt.maSecurityDescriptor.resize( nRead);
}
GetSheetProtectBuffer().AppendEnhancedProtection( aProt, GetCurrScTab() );