config: Null checks
This commit is contained in:
@@ -48,6 +48,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -992,7 +993,7 @@ public class ConfigPanel extends PluginPanel
|
|||||||
if (e.getStateChange() == ItemEvent.SELECTED)
|
if (e.getStateChange() == ItemEvent.SELECTED)
|
||||||
{
|
{
|
||||||
changeConfiguration(listItem, config, box, cd, cid);
|
changeConfiguration(listItem, config, box, cd, cid);
|
||||||
box.setToolTipText(box.getSelectedItem().toString());
|
box.setToolTipText(Objects.requireNonNull(box.getSelectedItem()).toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.add(box, BorderLayout.EAST);
|
item.add(box, BorderLayout.EAST);
|
||||||
@@ -1175,7 +1176,7 @@ public class ConfigPanel extends PluginPanel
|
|||||||
else if (component instanceof JComboBox)
|
else if (component instanceof JComboBox)
|
||||||
{
|
{
|
||||||
JComboBox jComboBox = (JComboBox) component;
|
JComboBox jComboBox = (JComboBox) component;
|
||||||
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), ((Enum) jComboBox.getSelectedItem()).name());
|
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), ((Enum) Objects.requireNonNull(jComboBox.getSelectedItem())).name());
|
||||||
|
|
||||||
for (ConfigItemDescriptor cid2 : cd.getItems())
|
for (ConfigItemDescriptor cid2 : cd.getItems())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public class PluginListItem extends JPanel
|
|||||||
buttonPanel.add(configButton);
|
buttonPanel.add(configButton);
|
||||||
|
|
||||||
// add a listener to configButton only if there are config items to show
|
// add a listener to configButton only if there are config items to show
|
||||||
if (config != null && !configDescriptor.getItems().stream().allMatch(item -> item.getItem().hidden()))
|
if (configDescriptor != null && config != null && !configDescriptor.getItems().stream().allMatch(item -> item.getItem().hidden()))
|
||||||
{
|
{
|
||||||
configButton.addActionListener(e ->
|
configButton.addActionListener(e ->
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user