Skip to content

Commit

Permalink
Fix NoSuchElementException in case no selection exists
Browse files Browse the repository at this point in the history
I have no idea in which case a selection changed event is sent that
doesn't contain a selected element, but this commit doesn't let the
exception occur anymore.
  • Loading branch information
kiritsuku committed Sep 12, 2014
1 parent d75bc58 commit d4b8704
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ class SaveActionsPreferencePage extends PreferencePage with IWorkbenchPreference
viewer = new CheckboxTableViewer(table)
viewer.setContentProvider(ContentProvider)
viewer.addSelectionChangedListener { e: SelectionChangedEvent =>
selectSaveAction(table.getSelection().head.getData().asInstanceOf[SaveActionSetting])
table.getSelection().headOption foreach { item =>
selectSaveAction(item.getData().asInstanceOf[SaveActionSetting])
}
}
viewer.addCheckStateListener { e: CheckStateChangedEvent =>
toggleSaveAction(e.getElement().asInstanceOf[SaveActionSetting])
Expand Down

0 comments on commit d4b8704

Please sign in to comment.