From 15c84139fa97a1445899d9fcca2b30001b199772 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 18 May 2017 20:03:40 +0100 Subject: [PATCH] Fix launcher failure with custom MP server When the user specified an MP server without providing a port, the launcher would pass a malformed command line, leading the the simulator bailing out. (Should go to the release branch) --- src/GUI/MPSettings.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/GUI/MPSettings.qml b/src/GUI/MPSettings.qml index 857e26e58..3403a0310 100644 --- a/src/GUI/MPSettings.qml +++ b/src/GUI/MPSettings.qml @@ -59,18 +59,25 @@ Section { placeholder: "localhost:5001" } + readonly property int defaultMPPort: 5000 + onApply: { if (enableMP.checked) { if (mpServer.currentIsCustom) { var pieces = mpCustomServer.value.split(':') + var port = defaultMPPort; + if (pieces.length > 1) { + port = pieces[1]; + } + _config.setProperty("/sim/multiplay/txhost", pieces[0]); - _config.setProperty("/sim/multiplay/txport", pieces[1]); + _config.setProperty("/sim/multiplay/txport", port); } else { var sel = mpServer.selectedIndex _config.setProperty("/sim/multiplay/txhost", _mpServers.serverForIndex(sel)); var port = _mpServers.portForIndex(sel); if (port == 0) { - port = 5000; // default MP port + port = defaultMPPort; } _config.setProperty("/sim/multiplay/txport", port);