mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- Fixing NPE in VLog and VStack that pops up 10x tournament
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user