forked from mirror/openmw-tes3mp
Fix crash if connection has failed
This commit is contained in:
parent
75061e2504
commit
753dc50131
4 changed files with 5 additions and 4 deletions
|
@ -632,6 +632,8 @@ private:
|
|||
void OMW::Engine::go()
|
||||
{
|
||||
assert (!mContentFiles.empty());
|
||||
if(!mwmp::Main::init(mContentFiles))
|
||||
return;
|
||||
|
||||
mViewer = new osgViewer::Viewer;
|
||||
|
||||
|
@ -660,7 +662,6 @@ void OMW::Engine::go()
|
|||
ToUTF8::Utf8Encoder encoder (mEncoding);
|
||||
mEncoder = &encoder;
|
||||
|
||||
mwmp::Main::init(mContentFiles);
|
||||
prepareEngine (settings);
|
||||
mwmp::Main::postInit();
|
||||
mSkipMenu = true;
|
||||
|
|
|
@ -113,7 +113,7 @@ void RestoreMgr(Settings::Manager &mgr)
|
|||
mgr.mChangedSettings = saveChangedSettings;
|
||||
}
|
||||
|
||||
void Main::init(std::vector<std::string> &content)
|
||||
bool Main::init(std::vector<std::string> &content)
|
||||
{
|
||||
assert(!pMain);
|
||||
pMain = new Main();
|
||||
|
@ -138,6 +138,7 @@ void Main::init(std::vector<std::string> &content)
|
|||
|
||||
pMain->mNetworking->connect(pMain->server, pMain->port);
|
||||
RestoreMgr(mgr);
|
||||
return pMain->mNetworking->isConnected();
|
||||
}
|
||||
|
||||
void Main::postInit()
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace mwmp
|
|||
|
||||
static void optionsDesc(boost::program_options::options_description *desc);
|
||||
static void configure(const boost::program_options::variables_map &variables);
|
||||
static void init(std::vector<std::string> &content);
|
||||
static bool init(std::vector<std::string> &content);
|
||||
static void postInit();
|
||||
static void destroy();
|
||||
static const Main &get();
|
||||
|
|
|
@ -170,7 +170,6 @@ void Networking::connect(const std::string &ip, unsigned short port)
|
|||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, errmsg.c_str());
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", errmsg.c_str(), 0);
|
||||
MWBase::Environment::get().getStateManager()->requestQuit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue