diff options
| author | Jonathan Bauer | 2015-09-16 14:47:13 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-09-16 14:47:13 +0200 |
| commit | cf17139567fbc4ec29dea2368a465423f6408ff2 (patch) | |
| tree | b523893480271a8fb378383c61b8b7e1f0a8c4d0 /dozentenmodul/src/main/java | |
| parent | [client] SatListWindow: Fix formating (diff) | |
| download | tutor-module-cf17139567fbc4ec29dea2368a465423f6408ff2.tar.gz tutor-module-cf17139567fbc4ec29dea2368a465423f6408ff2.tar.xz tutor-module-cf17139567fbc4ec29dea2368a465423f6408ff2.zip | |
[client] SatList: fix NPE if user closes SatListW
added nullcheck for generating radio button so that we can call it with null to force/fake a manual IP input field
Diffstat (limited to 'dozentenmodul/src/main/java')
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java | 20 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java | 3 |
2 files changed, 12 insertions, 11 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java index ecfc8bbe..399a9241 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java @@ -39,16 +39,18 @@ public class SatelliteListWindowLayout extends JDialog { ButtonGroup btnGroup = new ButtonGroup(); // --------------- radio buttons sat selection -------------------------------------- - selectionPanelGrid.add(new JLabel("Vorgegebene Server"), 2); - selectionPanelGrid.nextRow(); - // create the radioButtons, add them to the map, button group and the selection grid. - for (Satellite sat : satList) { - JRadioButton radioButton = new JRadioButton(sat.getDisplayName()); - radioButton.setEnabled(sat.addressList != null && !sat.addressList.isEmpty()); - radioToSat.put(radioButton, sat); - btnGroup.add(radioButton); - selectionPanelGrid.add(radioButton, 2).fill(true, false).expand(true, false); + if (satList != null && !satList.isEmpty()) { + selectionPanelGrid.add(new JLabel("Vorgegebene Server"), 2); selectionPanelGrid.nextRow(); + // create the radioButtons, add them to the map, button group and the selection grid. + for (Satellite sat : satList) { + JRadioButton radioButton = new JRadioButton(sat.getDisplayName()); + radioButton.setEnabled(sat.addressList != null && !sat.addressList.isEmpty()); + radioToSat.put(radioButton, sat); + btnGroup.add(radioButton); + selectionPanelGrid.add(radioButton, 2).fill(true, false).expand(true, false); + selectionPanelGrid.nextRow(); + } } // --------------- end radio buttons for sat selection ------------------------------------ diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java index b67b41b9..5a6f4566 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java @@ -109,7 +109,6 @@ public class ThriftActions { MessageType.ERROR, LOGGER, null); return false; } - // TODO: Show list if > 1 // Satellite sat = data.satellites.get(0); Satellite sat = null; if (data.satellites.size() == 1 && !LoginWindow.forceCustomSatellite) { @@ -118,7 +117,7 @@ public class ThriftActions { sat = SatelliteListWindow.open(window , data.satellites); } - if (sat.addressList == null) { + if (sat == null || sat.addressList == null) { // TODO: Ask for manual IP address entry Gui.asyncMessageBox( "Login erfolgreich, aber es wurde kein Satelliten-Server ausgewählt.\n" |
