diff options
-rw-r--r-- | src/client.cpp | 7 | ||||
-rw-r--r-- | src/game.cpp | 6 | ||||
-rw-r--r-- | src/gui/gui.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/windowcontainer.cpp | 2 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/client.cpp b/src/client.cpp index 0e62d9a52..2d4de8a9f 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -167,7 +167,7 @@ volatile int frame_count = 0; /**< Counts the frames during one second */ volatile int cur_time; volatile bool runCounters; bool isSafeMode = false; -int serverVersion; +int serverVersion = 0; int start_time; int textures_count = 0; @@ -2363,6 +2363,8 @@ void Client::resizeVideo(int width, int height) width = std::max(640, width); height = std::max(480, height); + if (!mainGraphics) + return; if (mainGraphics->mWidth == width && mainGraphics->mHeight == height) return; @@ -2396,7 +2398,8 @@ void Client::resizeVideo(int width, int height) if (mGame) mGame->videoResized(width, height); - gui->draw(); + if (gui) + gui->draw(); // Since everything appears to have worked out, remember to store the // new size in the configuration. diff --git a/src/game.cpp b/src/game.cpp index b6e956c98..fcec7731b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1947,6 +1947,8 @@ void Game::closeDialogs() void Game::videoResized(int width, int height) { - viewport->setSize(width, height); - windowMenu->setPosition(width - 3 - windowMenu->getWidth(), 3); + if (viewport) + viewport->setSize(width, height); + if (windowMenu) + windowMenu->setPosition(width - 3 - windowMenu->getWidth(), 3); } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e441111a9..1d8b45872 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -290,11 +290,14 @@ void Gui::videoResized() { WindowContainer *top = static_cast<WindowContainer*>(getTop()); - int oldWidth = top->getWidth(); - int oldHeight = top->getHeight(); + if (top) + { + int oldWidth = top->getWidth(); + int oldHeight = top->getHeight(); - top->setSize(mainGraphics->mWidth, mainGraphics->mHeight); - top->adjustAfterResize(oldWidth, oldHeight); + top->setSize(mainGraphics->mWidth, mainGraphics->mHeight); + top->adjustAfterResize(oldWidth, oldHeight); + } } void Gui::setUseCustomCursor(bool customCursor) diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index ce218e042..9e698ffa6 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -48,6 +48,8 @@ void WindowContainer::adjustAfterResize(int oldScreenWidth, int oldScreenHeight) { for (WidgetListIterator i = mWidgets.begin(); i != mWidgets.end(); ++i) + { if (Window *window = dynamic_cast<Window*>(*i)) window->adjustPositionAfterResize(oldScreenWidth, oldScreenHeight); + } } |