Fix a small regression caused by e2ad76f.
authorred-001 <red-001@outlook.ie>
Wed, 15 Feb 2017 19:14:31 +0000 (19:14 +0000)
committersfan5 <sfan5@live.de>
Thu, 16 Feb 2017 11:59:19 +0000 (12:59 +0100)
src/client/clientlauncher.cpp

index 1ac67a1decb9f714817eabc25c1054a09cbceec3..2adac53c2d55d8e79275423abb7596d87da8a4d8 100644 (file)
@@ -411,8 +411,6 @@ bool ClientLauncher::launch_game(std::string &error_message,
        playername = menudata.name;
        password = menudata.password;
 
-       g_settings->set("name", playername);
-
        current_playername = playername;
        current_password   = password;
        current_address    = address;
@@ -425,13 +423,16 @@ bool ClientLauncher::launch_game(std::string &error_message,
                current_password = "";
                current_address = "";
                current_port = myrand_range(49152, 65535);
-       } else if (address != "") {
-               ServerListSpec server;
-               server["name"] = menudata.servername;
-               server["address"] = menudata.address;
-               server["port"] = menudata.port;
-               server["description"] = menudata.serverdescription;
-               ServerList::insert(server);
+       } else {
+               g_settings->set("name", playername);
+               if (address != "") {
+                       ServerListSpec server;
+                       server["name"] = menudata.servername;
+                       server["address"] = menudata.address;
+                       server["port"] = menudata.port;
+                       server["description"] = menudata.serverdescription;
+                       ServerList::insert(server);
+               }
        }
 
        infostream << "Selected world: " << worldspec.name