diff options
Diffstat (limited to 'src/core/servers.c')
-rw-r--r-- | src/core/servers.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/servers.c b/src/core/servers.c index f99b238f..1e5c0b84 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -257,6 +257,8 @@ static void server_connect_callback_readpipe(SERVER_REC *server) /* initializes server record but doesn't start connecting */ void server_connect_init(SERVER_REC *server) { + const char *str; + g_return_if_fail(server != NULL); MODULE_DATA_INIT(server); @@ -267,16 +269,16 @@ void server_connect_init(SERVER_REC *server) if (server->connrec->username == NULL || *server->connrec->username == '\0') { g_free_not_null(server->connrec->username); - server->connrec->username = g_get_user_name(); - if (*server->connrec->username == '\0') server->connrec->username = "-"; - server->connrec->username = g_strdup(server->connrec->username); + str = g_get_user_name(); + if (*str == '\0') str = "-"; + server->connrec->username = g_strdup(str); } if (server->connrec->realname == NULL || *server->connrec->realname == '\0') { g_free_not_null(server->connrec->realname); - server->connrec->realname = g_get_real_name(); - if (*server->connrec->realname == '\0') server->connrec->realname = "-"; - server->connrec->realname = g_strdup(server->connrec->realname); + str = g_get_real_name(); + if (*str == '\0') str = "-"; + server->connrec->realname = g_strdup(str); } server->tag = server_create_tag(server->connrec); |