Index: modules/shortcut/shortcut.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.admin.inc,v
retrieving revision 1.13
diff -u -p -r1.13 shortcut.admin.inc
--- modules/shortcut/shortcut.admin.inc	24 Apr 2010 14:49:14 -0000	1.13
+++ modules/shortcut/shortcut.admin.inc	20 May 2010 07:41:48 -0000
@@ -102,6 +102,24 @@ function shortcut_set_switch($form, &$fo
 }
 
 /**
+ * Validation handler for shortcut_set_switch().
+ */
+function shortcut_set_switch_validate($form, &$form_state) {
+  if ($form_state['values']['set'] == 'new') {
+    // check to prevent creating shortcut set with empty label.
+    if (trim($form_state['values']['new']) == '') {
+      form_set_error('new', t('New set name can not be empty.'));
+    }
+    // check to prevent duplicate label.
+    foreach (shortcut_sets() as $set) {
+      if ($set->title == $form_state['values']['new']) {
+        form_set_error('new', t('The shortcut set %name already exists. Choose another name.', array('%name' => $form_state['values']['new'])));
+      }
+    }
+  }
+}
+
+/**
  * Submit handler for shortcut_set_switch().
  */
 function shortcut_set_switch_submit($form, &$form_state) {
@@ -191,6 +209,7 @@ function shortcut_set_add_form($form, &$
     '#type' => 'textfield',
     '#title' => t('Set name'),
     '#description' => t('The new set is created by copying items from your default shortcut set.'),
+    '#required' => TRUE,
   );
 
   $form['actions'] = array('#type' => 'actions');
