1
0
Fork 0

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)
This commit is contained in:
James Turner 2017-05-18 20:03:40 +01:00
parent 18b8b59af6
commit 15c84139fa

View file

@ -59,18 +59,25 @@ Section {
placeholder: "localhost:5001" placeholder: "localhost:5001"
} }
readonly property int defaultMPPort: 5000
onApply: { onApply: {
if (enableMP.checked) { if (enableMP.checked) {
if (mpServer.currentIsCustom) { if (mpServer.currentIsCustom) {
var pieces = mpCustomServer.value.split(':') 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/txhost", pieces[0]);
_config.setProperty("/sim/multiplay/txport", pieces[1]); _config.setProperty("/sim/multiplay/txport", port);
} else { } else {
var sel = mpServer.selectedIndex var sel = mpServer.selectedIndex
_config.setProperty("/sim/multiplay/txhost", _mpServers.serverForIndex(sel)); _config.setProperty("/sim/multiplay/txhost", _mpServers.serverForIndex(sel));
var port = _mpServers.portForIndex(sel); var port = _mpServers.portForIndex(sel);
if (port == 0) { if (port == 0) {
port = 5000; // default MP port port = defaultMPPort;
} }
_config.setProperty("/sim/multiplay/txport", port); _config.setProperty("/sim/multiplay/txport", port);