From 7cf5cb58865bc5f3951a6f4e40cf892ede96fc5a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 Jan 2012 18:35:21 +0300 Subject: Update copyrights year. --- src/map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index 79dd01c41..0f2f2bf47 100644 --- a/src/map.h +++ b/src/map.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * -- cgit v1.2.3-70-g09d2 From bf1a006a34ba30143c00be899332acedef29575b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 13 Jan 2012 22:24:59 +0300 Subject: Fix possible incorrect memory access. --- src/gui/socialwindow.cpp | 2 +- src/map.cpp | 3 +++ src/map.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/map.h') diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 2d8ecc54f..b2c28e84e 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -650,7 +650,7 @@ public: return; Map* map = socialWindow->getMap(); - if (!map) + if (!map || map->empty()) return; if (socialWindow->getProcessedPortals()) diff --git a/src/map.cpp b/src/map.cpp index 63b815af2..211504504 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1392,6 +1392,9 @@ Path Map::findPath(int startX, int startY, int destX, int destY, // Reset starting tile's G cost to 0 MetaTile *startTile = &mMetaTiles[startX + startY * mWidth]; + if (!startTile) + return path; + startTile->Gcost = 0; // Add the start point to the open list diff --git a/src/map.h b/src/map.h index 0f2f2bf47..db8b092de 100644 --- a/src/map.h +++ b/src/map.h @@ -498,6 +498,9 @@ class Map : public Properties, public ConfigListener void redrawMap(); + bool empty() + { return mLayers.empty(); } + protected: friend class Actor; friend class Minimap; -- cgit v1.2.3-70-g09d2