New partition dialog: first filesystem in list is always included

Even if invalid, the first filesystem in list is always included.

This is an off-by-one error, which was triggered when the first member
of FILESYSTEMS was no longer a regular filesystem, as a result of
commit ce9feeda0e9a04da04cec0a1b01512ed68c2495c:
'Make FileSystem objects in GParted_Core accessible and usable by others'
This commit is contained in:
Rogier Goossens 2012-02-18 12:40:11 +01:00 committed by Curtis Gedak
parent 387feb143a
commit 1197a52174
1 changed files with 7 additions and 5 deletions

View File

@ -46,13 +46,15 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
this ->FILESYSTEMS = FILESYSTEMS ;
//remove all non-valid file systems
for ( unsigned int t = this ->FILESYSTEMS .size( ) ; t > 0 ; t-- )
std::vector< FS >::iterator f ;
for ( f = this->FILESYSTEMS .begin(); f != this->FILESYSTEMS .end(); f++ )
{
if ( this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_UNKNOWN ||
this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_LVM2_PV ||
this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_LUKS
if ( f ->filesystem == GParted::FS_UNKNOWN
|| f ->filesystem == GParted::FS_LVM2_PV
|| f ->filesystem == GParted::FS_LUKS
)
this ->FILESYSTEMS .erase( this->FILESYSTEMS .begin() + t ) ;
//Compensate for subsequent 'f++' ...
f = this ->FILESYSTEMS .erase( f ) - 1 ;
}
FS fs_tmp ;