Fixed application crash when saving details and locale not set

svn path=/trunk/; revision=1012
This commit is contained in:
Curtis Gedak 2008-12-21 18:55:10 +00:00
parent 3aa38a3563
commit 8a1760928f
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-12-21 Curtis Gedak <gedakc@gmail.com>
* src/Utils.cc: Fixed application crash.
- GParted would crash when saving details if locale was not set.
2008-12-20 Curtis Gedak <gedakc@gmail.com>
* src/ext4.cc: Add flags to create journal and use extent option.

View File

@ -406,6 +406,9 @@ Glib::ustring Utils::get_lang()
//Convert the underscore "_" to a hyphen "-"
Glib::ustring sought = "_" ;
Glib::ustring replacement = "-" ;
//NOTE: Application crashes if string replace is called and sought is not found,
// so we need to only perform replace if the sought is found.
if ( lang .find(sought) != Glib::ustring::npos )
lang .replace( lang .find(sought), sought .size(), replacement ) ;
return lang ;