reverting change made in r2701

The conditions on which to "updateStats" during the rebuilding of filters needed to be updated.  stw is NULL
when rebuilding the filters due to a "UNLOCK CARDS" action.  Thus the call to stw->updateStats throws a NPE.
stw is not null only when a deck has been selected to edit.  Otherwise, it makes no sense to actually update the
stats of a non-selected deck.
This commit is contained in:
techdragon.nguyen@gmail.com
2010-11-29 11:50:12 +00:00
parent 0856ddaeb2
commit b46112dfcd
2 changed files with 7 additions and 7 deletions

View File

@@ -260,12 +260,9 @@ void StatsWrapper::updateStats(string filename, MTGAllCards *collection)
void StatsWrapper::updateStats(DeckDataWrapper *myDeck)
{
if (!myDeck)
{
return;
}
if (!this->needUpdate) return;
this->needUpdate = false;
if (!this->needUpdate || !myDeck) return;
this->needUpdate = false;
this->cardCount = myDeck->getCount(WSrcDeck::UNFILTERED_COPIES);
this->countLands = myDeck->getCount(Constants::MTG_COLOR_LAND);
this->totalPrice = myDeck->totalPrice();

View File

@@ -101,7 +101,10 @@ void GameStateDeckViewer::rebuildFilters()
filterMenu->setSrc(source);
if (displayed_deck != myDeck) source->swapSrc();
filterMenu->Finish(true);
stw->updateStats( myDeck );;
// no stats need updating if there isn't a deck to update
if (stw && myDeck)
stw->updateStats( myDeck );;
}
void GameStateDeckViewer::updateFilters()
{