No joinning of password-proected server if no password is given

This commit is contained in:
Benau
2018-06-04 09:41:50 +08:00
parent 2fbf0ab49f
commit aa1bb720e3
2 changed files with 8 additions and 1 deletions

View File

@@ -97,6 +97,8 @@ void ServerInfoDialog::requestJoin()
if (m_server->isPasswordProtected())
{
assert(m_password != NULL);
if (m_password->getText().empty())
return;
NetworkConfig::get()->setPassword(
StringUtils::wideToUtf8(m_password->getText()));
}
@@ -157,6 +159,11 @@ bool ServerInfoDialog::onEscapePressed()
// -----------------------------------------------------------------------------
void ServerInfoDialog::onUpdate(float dt)
{
if (m_password && m_password->getText().empty())
m_join_widget->setActive(false);
else if (!m_join_widget->isActivated())
m_join_widget->setActive(true);
// It's unsafe to delete from inside the event handler so we do it here
if (m_self_destroy)
{

View File

@@ -48,7 +48,7 @@ private:
GUIEngine::RibbonWidget *m_options_widget;
/** The joinb button. */
/** The join button. */
GUIEngine::IconButtonWidget *m_join_widget;
/** The cancel button. */