From 8a1760928fe7bf18c7abe72fd30d22ec8d1cc6d9 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Sun, 21 Dec 2008 18:55:10 +0000 Subject: [PATCH] Fixed application crash when saving details and locale not set svn path=/trunk/; revision=1012 --- ChangeLog | 5 +++++ src/Utils.cc | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bfad9dfa..13f6f2e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-12-21 Curtis Gedak + + * src/Utils.cc: Fixed application crash. + - GParted would crash when saving details if locale was not set. + 2008-12-20 Curtis Gedak * src/ext4.cc: Add flags to create journal and use extent option. diff --git a/src/Utils.cc b/src/Utils.cc index c31fbf75..fb68511f 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -406,7 +406,10 @@ Glib::ustring Utils::get_lang() //Convert the underscore "_" to a hyphen "-" Glib::ustring sought = "_" ; Glib::ustring replacement = "-" ; - lang .replace( lang .find(sought), sought .size(), 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 ; }