1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-09 13:59:49 -04:00

Fix NPE in SubtitleMappingOptionRenderer

This commit is contained in:
Reinhard Pointner 2018-11-07 21:10:41 +07:00
parent 66b1141355
commit b27844a41d

View File

@ -366,10 +366,10 @@ class SubtitleAutoMatchDialog extends JDialog {
@Override @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
SubtitleMapping mapping = (SubtitleMapping) value; SubtitleMapping mapping = (SubtitleMapping) value;
SubtitleDescriptorBean subtitleBean = mapping.getSelectedOption(); SubtitleDescriptorBean subtitleBean = mapping != null ? mapping.getSelectedOption() : null;
// render combobox for subtitle options // render combobox for subtitle options
if (mapping.isEditable() && subtitleBean != null) { if (mapping != null && mapping.isEditable() && subtitleBean != null) {
optionComboBox.setModel(new DefaultComboBoxModel(new Object[] { subtitleBean })); optionComboBox.setModel(new DefaultComboBoxModel(new Object[] { subtitleBean }));
return optionComboBox; return optionComboBox;
} }
@ -379,7 +379,7 @@ class SubtitleAutoMatchDialog extends JDialog {
setForeground(table.getForeground()); setForeground(table.getForeground());
if (subtitleBean == null) { if (subtitleBean == null) {
if (mapping.getOptions().length == 0) { if (mapping != null && mapping.getOptions().length == 0) {
// no subtitles found // no subtitles found
setText("No subtitles found"); setText("No subtitles found");
setIcon(null); setIcon(null);
@ -398,7 +398,7 @@ class SubtitleAutoMatchDialog extends JDialog {
// download in progress // download in progress
setText(subtitleBean.getText()); setText(subtitleBean.getText());
setIcon(ResourceManager.getIcon("action.fetch")); setIcon(ResourceManager.getIcon("action.fetch"));
} else if (mapping.getSubtitleFile() != null) { } else if (mapping != null && mapping.getSubtitleFile() != null) {
// download complete // download complete
setText(mapping.getSubtitleFile().getName()); setText(mapping.getSubtitleFile().getName());
setIcon(ResourceManager.getIcon("status.ok")); setIcon(ResourceManager.getIcon("status.ok"));