bugfix: do not crash if clicking Rename with nothing selected

This commit is contained in:
Anton Keks 2016-12-11 19:52:20 +02:00
parent 896f534029
commit 32d41f0c1c

View File

@ -96,7 +96,9 @@ public class EditFavoritesDialog extends AbstractModalDialog {
class RenameListener implements Listener {
public void handleEvent(Event event) {
int index = favoritesList.getSelectionIndex();
if (favoritesConfig.size() == 0) return;
int index = Math.max(favoritesList.getSelectionIndex(), 0);
InputDialog prompt = new InputDialog(Labels.getLabel("title.rename"), "");
String oldName = favoritesList.getItem(index);
String newName = prompt.open(oldName);