#837 Sorted list ArrayIndexOutOfBoundsException during alias save. (#858)

Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
Denny Sheirer
2020-06-11 04:59:15 -04:00
committed by GitHub
parent bbe90ca74b
commit d957846ab0

View File

@@ -330,12 +330,9 @@ public class AliasItemEditor extends Editor<Alias>
if(alias != null)
{
alias.setName(getNameField().getText());
alias.setGroup(getGroupField().getText());
alias.setRecordable(getRecordAudioToggleSwitch().isSelected());
alias.setColor(ColorUtil.toInteger(getColorPicker().getValue()));
Icon icon = getIconNodeComboBox().getSelectionModel().getSelectedItem();
alias.setIconName(icon != null ? icon.getName() : null);
@@ -377,6 +374,27 @@ public class AliasItemEditor extends Editor<Alias>
{
alias.addAliasAction(aliasAction);
}
//Hack: because we're using a sorted list for the alias editor, sometimes setting
//name and or group can cause list errors. So, we wrap each of these in a try/catch
//block to mitigate the error and effect the changes.
try
{
alias.setName(getNameField().getText());
}
catch(Exception e)
{
mLog.error("Error while updating alias name.", e);
}
try
{
alias.setGroup(getGroupField().getText());
}
catch(Exception e)
{
mLog.error("Error while updating alias group value", e);
}
}
AliasList aliasList = mPlaylistManager.getAliasModel().getAliasList(alias.getAliasListName());