linux: Fix crash when we can't get the username. Closes #1472

This commit is contained in:
Hylke Bons 2014-03-03 11:42:11 +00:00
parent ac5f3c7acd
commit c0486093fe

View file

@ -71,10 +71,16 @@ namespace SparkleShare {
ActivatesDefault = true
};
UnixUserInfo user_info = UnixUserInfo.GetRealUser ();
try {
UnixUserInfo user_info = UnixUserInfo.GetRealUser ();
if (user_info != null && user_info.RealName != null)
name_entry.Text = user_info.RealName.TrimEnd (",".ToCharArray ());
if (user_info != null && user_info.RealName != null)
// Some systems append a series of "," for some reason
name_entry.Text = user_info.RealName.TrimEnd (",".ToCharArray ());
} catch (ArgumentException) {
// No username, not a big deal
}
Entry email_entry = new Entry () {
Xalign = 0,