Commit 387feb14 authored by Rogier Goossens's avatar Rogier Goossens Committed by Curtis Gedak
Browse files

Fix for implicit assumption that 'FS_UNKNOWN' is last in FILESYSTEMS list

This assumption was invalidated by commit
ce9feeda:
'Make FileSystem objects in GParted_Core accessible and usable by others'

This patch removes the dependency on this implicit assumption.
parent 9e2bef97
......@@ -693,11 +693,24 @@ const std::vector<FS> & GParted_Core::get_filesystems() 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++ )
{
if ( FILESYSTEMS[ t ] .filesystem == filesystem )
return FILESYSTEMS[ t ] ;
return FILESYSTEMS .back() ;
else if ( FILESYSTEMS[ t ] .filesystem == FS_UNKNOWN )
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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment