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:
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user