From 3e0bce53e2b3387801f3e0484f01a64d767115da Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 7 Aug 2017 02:23:04 +0300 Subject: Allow open debug window before connecting to game. --- src/gui/widgets/tabs/debugwindowtabs.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/tabs/debugwindowtabs.cpp') diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp index 4a600d2fd..321c3bcad 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.cpp +++ b/src/gui/widgets/tabs/debugwindowtabs.cpp @@ -183,8 +183,10 @@ void MapDebugTab::logic() mXYLabel->setCaption(strprintf("%s (?, ?)", _("Player Position:"))); } - const Map *const map = Game::instance()->getCurrentMap(); - if ((map != nullptr) && (viewport != nullptr)) + Game *const game = Game::instance(); + const Map *const map = game != nullptr ? game->getCurrentMap() : nullptr; + if (map != nullptr && + viewport != nullptr) { // Get the current mouse position const int mouseTileX = (viewport->mMouseX + viewport->getCameraX()) -- cgit v1.2.3-60-g2f50