diff --git a/CCallback.cpp b/CCallback.cpp index 6c49d59fd..3e4109f12 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -970,7 +970,7 @@ std::vector < const CGObjectInstance * > CCallback::getMyObjects() const std::vector < const CGObjectInstance * > ret; for (int g=0; gmap->objects.size(); ++g) { - if (gs->map->objects[g]->tempOwner == LOCPLINT->playerID) + if (gs->map->objects[g] && gs->map->objects[g]->tempOwner == LOCPLINT->playerID) { ret.push_back(gs->map->objects[g]); } diff --git a/client/CHeroWindow.cpp b/client/CHeroWindow.cpp index f9d410161..53226ea67 100644 --- a/client/CHeroWindow.cpp +++ b/client/CHeroWindow.cpp @@ -194,16 +194,15 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded /*= fals { AdventureMapButton * split = NULL; - { - BLOCK_CAPTURING; - split = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::bind(&CGarrisonInt::splitClick,garr), pos.x + 539, pos.y + 519, "hsbtns9.def", false, NULL, false); //deleted by garrison destructor - boost::algorithm::replace_first(split->hoverTexts[0],"%s",CGI->generaltexth->allTexts[43]); - } - //delete garr; OBJ_CONSTRUCTION_CAPTURING_ALL; if(!garr) { garr = new CGarrisonInt(15, 485, 8, Point(), background->bg, Point(15,485), curHero); + { + BLOCK_CAPTURING; + split = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::bind(&CGarrisonInt::splitClick,garr), pos.x + 539, pos.y + 519, "hsbtns9.def", false, NULL, false); //deleted by garrison destructor + boost::algorithm::replace_first(split->hoverTexts[0],"%s",CGI->generaltexth->allTexts[43]); + } garr->addSplitBtn(split); } if(!artSets.size()) diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index 33043fc34..b600e1df6 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -455,7 +455,7 @@ void CGarrisonInt::splitClick() if(!highlighted) return; splitting = !splitting; - show(screen2); + redraw(); } void CGarrisonInt::splitStacks(int am2) {