Skip to content
Permalink
Browse files
Merge pull request #8534 from JosJuice/netplay-index-empty-strings
Properly check for missing netplay session name/region
  • Loading branch information
Helios747 committed Dec 26, 2019
2 parents 0341288 + 0c12dbe commit 0755f92
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
@@ -169,8 +169,11 @@ static void ClearPeerPlayerId(ENetPeer* peer)

void NetPlayServer::SetupIndex()
{
if (!Config::Get(Config::NETPLAY_USE_INDEX))
if (!Config::Get(Config::NETPLAY_USE_INDEX) || Config::Get(Config::NETPLAY_INDEX_NAME).empty() ||
Config::Get(Config::NETPLAY_INDEX_REGION).empty())
{
return;
}

NetPlaySession session;

@@ -227,6 +227,14 @@ void NetPlaySetupDialog::ConnectWidgets()
connect(m_host_chunked_upload_limit_box,
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
&NetPlaySetupDialog::SaveSettings);

connect(m_host_server_browser, &QCheckBox::toggled, this, &NetPlaySetupDialog::SaveSettings);
connect(m_host_server_name, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings);
connect(m_host_server_password, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings);
connect(m_host_server_region,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&NetPlaySetupDialog::SaveSettings);

#ifdef USE_UPNP
connect(m_host_upnp, &QCheckBox::stateChanged, this, &NetPlaySetupDialog::SaveSettings);
#endif
@@ -328,6 +336,14 @@ void NetPlaySetupDialog::accept()
return;
}

if (m_host_server_browser->isChecked() &&
m_host_server_region->currentData().toString().isEmpty())
{
ModalMessageBox::critical(this, tr("Error"),
tr("You must provide a region for your session!"));
return;
}

emit Host(items[0]->text());
}
}

0 comments on commit 0755f92

Please sign in to comment.