Fix for implicit assumption that 'FS_UNKNOWN' is last in FILESYSTEMS list
This assumption was invalidated by commit ce9feeda0e9a04da04cec0a1b01512ed68c2495c: 'Make FileSystem objects in GParted_Core accessible and usable by others' This patch removes the dependency on this implicit assumption.
This commit is contained in:
parent
9e2bef970a
commit
387feb143a
|
@ -693,11 +693,24 @@ const std::vector<FS> & GParted_Core::get_filesystems() const
|
||||||
|
|
||||||
const FS & GParted_Core::get_fs( GParted::FILESYSTEM filesystem ) const
|
const FS & GParted_Core::get_fs( GParted::FILESYSTEM filesystem ) const
|
||||||
{
|
{
|
||||||
|
unsigned int unknown ;
|
||||||
|
|
||||||
|
unknown = FILESYSTEMS .size() ;
|
||||||
for ( unsigned int t = 0 ; t < FILESYSTEMS .size() ; t++ )
|
for ( unsigned int t = 0 ; t < FILESYSTEMS .size() ; t++ )
|
||||||
|
{
|
||||||
if ( FILESYSTEMS[ t ] .filesystem == filesystem )
|
if ( FILESYSTEMS[ t ] .filesystem == filesystem )
|
||||||
return FILESYSTEMS[ t ] ;
|
return FILESYSTEMS[ t ] ;
|
||||||
|
else if ( FILESYSTEMS[ t ] .filesystem == FS_UNKNOWN )
|
||||||
return FILESYSTEMS .back() ;
|
unknown = t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( unknown == FILESYSTEMS .size() ) {
|
||||||
|
// This shouldn't happen, but just in case...
|
||||||
|
static FS fs;
|
||||||
|
fs .filesystem = FS_UNKNOWN ;
|
||||||
|
return fs ;
|
||||||
|
} else
|
||||||
|
return FILESYSTEMS[ unknown ] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Glib::ustring> GParted_Core::get_disklabeltypes()
|
std::vector<Glib::ustring> GParted_Core::get_disklabeltypes()
|
||||||
|
|
Loading…
Reference in New Issue