mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 15:41:24 +02:00
- fixed null pointer discovered by titi
This commit is contained in:
@@ -1089,7 +1089,10 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
|
||||
else if(obj != NULL){
|
||||
targetUnit= NULL;
|
||||
highlightedResourceObjectPos=Map::toSurfCoords(obj->getMapPos());
|
||||
getHighlightedResourceObject()->resetHighlight();
|
||||
|
||||
Object *selObj = getHighlightedResourceObject();
|
||||
if(selObj != NULL) {
|
||||
selObj->resetHighlight();
|
||||
// get real click pos
|
||||
renderer.computePosition(screenPos, targetPos);
|
||||
|
||||
@@ -1176,7 +1179,10 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
|
||||
targetPos= obj->getMapPos();
|
||||
posObjWorld= targetPos;
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
targetUnit= NULL;
|
||||
@@ -1184,10 +1190,13 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
|
||||
validPosObjWorld= true;
|
||||
posObjWorld= targetPos;
|
||||
|
||||
if(world->getMap()->getSurfaceCell(Map::toSurfCoords(targetPos))->getResource()!=NULL)
|
||||
{
|
||||
if(world->getMap()->getSurfaceCell(Map::toSurfCoords(targetPos))->getResource() != NULL) {
|
||||
highlightedResourceObjectPos=Map::toSurfCoords(targetPos);
|
||||
getHighlightedResourceObject()->resetHighlight();
|
||||
|
||||
Object *selObj = getHighlightedResourceObject();
|
||||
if(selObj != NULL) {
|
||||
selObj->resetHighlight();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user