Fixed username detection bug

This commit is contained in:
Mathew 2015-11-25 06:19:59 -05:00 committed by Mathew Velasquez
parent b625d2e891
commit dd8bbcad97

View file

@ -258,8 +258,8 @@ Oneshot::Oneshot(const RGSSThreadData &threadData)
struct passwd *pwd = getpwuid(getuid()); struct passwd *pwd = getpwuid(getuid());
if (pwd) if (pwd)
{ {
if (pwd->pw_gecos && pwd->pw_gecos[0] != ',') if (pwd->pw_gecos && pwd->pw_gecos[0] && pwd->pw_gecos[0] != ',')
{ {
//Get the user's full name //Get the user's full name
int comma = 0; int comma = 0;
for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {} for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {}