From 441463327c23d0a49961e403f29e81ebb19b2ee1 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 25 Jun 2018 09:57:40 +0400 Subject: [PATCH] Validate map size --- apps/openmw/mwgui/hud.cpp | 4 +++- apps/openmw/mwgui/mapwindow.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 23eb499de..1841303f2 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -158,7 +158,9 @@ namespace MWGui getWidget(mCrosshair, "Crosshair"); - LocalMapBase::init(mMinimap, mCompass, Settings::Manager::getInt("local map hud widget size", "Map"), Settings::Manager::getInt("local map cell distance", "Map")); + int mapSize = std::max(1, Settings::Manager::getInt("local map hud widget size", "Map")); + int cellDistance = std::max(1, Settings::Manager::getInt("local map cell distance", "Map")); + LocalMapBase::init(mMinimap, mCompass, mapSize, cellDistance); mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked); mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver); diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index d3c1ec292..c1ff9510d 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -679,7 +679,9 @@ namespace MWGui mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart); mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked); - LocalMapBase::init(mLocalMap, mPlayerArrowLocal, Settings::Manager::getInt("local map widget size", "Map"), Settings::Manager::getInt("local map cell distance", "Map")); + int mapSize = std::max(1, Settings::Manager::getInt("local map widget size", "Map")); + int cellDistance = std::max(1, Settings::Manager::getInt("local map cell distance", "Map")); + LocalMapBase::init(mLocalMap, mPlayerArrowLocal, mapSize, cellDistance); mGlobalMap->setVisible(mGlobal); mLocalMap->setVisible(!mGlobal);