- Fixing NPE in VLog and VStack that pops up 10x tournament

This commit is contained in:
Sol
2014-12-15 04:49:11 +00:00
parent 25c2e67979
commit d3e7051f34
2 changed files with 14 additions and 5 deletions

View File

@@ -18,6 +18,7 @@
package forge.screens.match.views;
import java.util.List;
import java.util.ArrayList;
import javax.swing.JPanel;
@@ -176,10 +177,13 @@ public enum VLog implements IVDoc<CLog> {
private List<GameLogEntry> getNewGameLogEntries(final GameView model) {
String logEntryType = FModel.getPreferences().getPref(FPref.DEV_LOG_ENTRY_TYPE);
GameLogEntryType logVerbosityFilter = GameLogEntryType.valueOf(logEntryType);
List<GameLogEntry> logEntries = model.getGameLog().getLogEntries(logVerbosityFilter);
// Set subtraction - remove all log entries from new list which are already displayed.
logEntries.removeAll(this.displayedLogEntries);
return logEntries;
if (model != null && model.getGameLog() != null) {
List<GameLogEntry> logEntries = model.getGameLog().getLogEntries(logVerbosityFilter);
// Set subtraction - remove all log entries from new list which are already displayed.
logEntries.removeAll(this.displayedLogEntries);
return logEntries;
}
return new ArrayList<GameLogEntry>();
}
private void addNewLogEntriesToJPanel(List<GameLogEntry> newLogEntries) {

View File

@@ -118,6 +118,11 @@ public enum VStack implements IVDoc<CStack> {
public void updateStack() {
final GameView model = MatchUtil.getGameView();
if (model == null) {
return;
}
final FCollectionView<StackItemView> items = model.getStack();
tab.setText("Stack : " + items.size());
@@ -228,7 +233,7 @@ public enum VStack implements IVDoc<CStack> {
});
}
final DetailColors color = CardDetailUtil.getBorderColor(item.getSourceCard().getCurrentState(), true);
final DetailColors color = CardDetailUtil.getBorderColor(item.getSourceCard().getCurrentState(), true);
setBackground(new Color(color.r, color.g, color.b));
setForeground(FSkin.getHighContrastColor(getBackground()));
}