From 72b7a957af331c7481a60705d1a35a78b5afb494 Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Tue, 13 Aug 2019 19:58:27 +0200 Subject: Fix unnecessary exception use in Map::getSectorXXX (#8792) The Map::getSectorNoGenerate throws an exception but no other code is really dependent on that. Fix the odd instance of misuse in ClientMap::emergeSector and remove the exception throwing version of the method along with the "NoEx" suffixes in the names of these methods. --- src/client/clientmap.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/client') diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp index 8a182b14a..15fa45940 100644 --- a/src/client/clientmap.cpp +++ b/src/client/clientmap.cpp @@ -63,14 +63,13 @@ ClientMap::ClientMap( MapSector * ClientMap::emergeSector(v2s16 p2d) { // Check that it doesn't exist already - try { - return getSectorNoGenerate(p2d); - } catch(InvalidPositionException &e) { - } + MapSector *sector = getSectorNoGenerate(p2d); - // Create a sector - MapSector *sector = new MapSector(this, p2d, m_gamedef); - m_sectors[p2d] = sector; + // Create it if it does not exist yet + if (!sector) { + sector = new MapSector(this, p2d, m_gamedef); + m_sectors[p2d] = sector; + } return sector; } -- cgit v1.2.3