Fixed crash when creating a network game.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include "gamedata.h"
|
||||
|
||||
gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c)
|
||||
: QDialog(parent), myW(NULL), myConfig(c), currentGameName(""), isAdmin(false)
|
||||
: QDialog(parent), myW(NULL), mySession(NULL), myConfig(c), currentGameName(""), isAdmin(false)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@@ -164,6 +164,7 @@ void gameLobbyDialogImpl::addConnectedPlayer(QString playerName, int rights) {
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedPlayers,0);
|
||||
item->setData(0, 0, playerName);
|
||||
|
||||
assert(mySession);
|
||||
GameInfo info = mySession->getClientGameInfo(currentGameName.toUtf8().constData());
|
||||
|
||||
if(treeWidget_connectedPlayers->topLevelItemCount() != info.data.maxNumberOfPlayers) {
|
||||
|
||||
@@ -785,6 +785,8 @@ void mainWindowImpl::callCreateNetworkGameDialog() {
|
||||
gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
|
||||
gameData.playerActionTimeoutSec = myCreateNetworkGameDialog->spinBox_netTimeOutPlayerAction->value();
|
||||
|
||||
myGameLobbyDialog->setSession(&getSession());
|
||||
myGameLobbyDialog->treeWidget_GameList->clear();
|
||||
myStartNetworkGameDialog->setSession(&getSession());
|
||||
myStartNetworkGameDialog->treeWidget->clear();
|
||||
|
||||
@@ -810,6 +812,8 @@ void mainWindowImpl::callJoinNetworkGameDialog() {
|
||||
if (myServerGuiInterface.get())
|
||||
myServerGuiInterface->getSession().terminateNetworkServer();
|
||||
|
||||
myGameLobbyDialog->setSession(&getSession());
|
||||
myGameLobbyDialog->treeWidget_GameList->clear();
|
||||
myStartNetworkGameDialog->setSession(&getSession());
|
||||
myStartNetworkGameDialog->treeWidget->clear();
|
||||
// Maybe use QUrl::toPunycode.
|
||||
|
||||
Reference in New Issue
Block a user