Prevent crash when winning quest match

This commit is contained in:
drdev
2014-07-16 03:32:46 +00:00
parent b89672a45f
commit 8a681df8e6

View File

@@ -16,6 +16,7 @@
*/ */
package forge.screens.match.winlose; package forge.screens.match.winlose;
import forge.FThreads;
import forge.GuiBase; import forge.GuiBase;
import forge.LobbyPlayer; import forge.LobbyPlayer;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -133,19 +134,24 @@ public class QuestWinLose extends ControlWinLose {
if (!lastGame.getMatch().isMatchOver()) { if (!lastGame.getMatch().isMatchOver()) {
getView().getBtnQuit().setText("Quit (-15 Credits)"); getView().getBtnQuit().setText("Quit (-15 Credits)");
return isAnte; return isAnte;
} else { }
else {
getView().getBtnContinue().setVisible(false); getView().getBtnContinue().setVisible(false);
if (wonMatch) { if (wonMatch) {
getView().getBtnQuit().setText("Great!"); getView().getBtnQuit().setText("Great!");
} else { }
else {
getView().getBtnQuit().setText("OK"); getView().getBtnQuit().setText("OK");
} }
} }
//invoke remaining logic in background thread so dialogs can be shown
FThreads.invokeInBackgroundThread(new Runnable() {
@Override
public void run() {
// TODO: We don't have a enum for difficulty? // TODO: We don't have a enum for difficulty?
int difficulty = qData.getAchievements().getDifficulty(); int difficulty = qData.getAchievements().getDifficulty();
final int wins = qData.getAchievements().getWin(); final int wins = qData.getAchievements().getWin();
// Win case // Win case
if (wonMatch) { if (wonMatch) {
@@ -192,7 +198,8 @@ public class QuestWinLose extends ControlWinLose {
awardBooster(); awardBooster();
} }
} }
}
});
return true; return true;
} }
@@ -607,7 +614,6 @@ public class QuestWinLose extends ControlWinLose {
* *
*/ */
private void awardBooster() { private void awardBooster() {
List<PaperCard> cardsWon = null; List<PaperCard> cardsWon = null;
if (qData.getFormat() == null) { if (qData.getFormat() == null) {