From 432d6244f3b9414d0e12d702ec700babc2df30f6 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Wed, 10 Jan 2007 08:08:44 +0000 Subject: #108130: Don't allow empty autocomplete searches --- modules/user/user.module | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules/user/user.module') diff --git a/modules/user/user.module b/modules/user/user.module index f278f468c..2f9398803 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -2442,9 +2442,11 @@ function _user_forms(&$edit, $account, $category, $hook = 'form') { */ function user_autocomplete($string = '') { $matches = array(); - $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10); - while ($user = db_fetch_object($result)) { - $matches[$user->name] = check_plain($user->name); + if ($string) { + $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10); + while ($user = db_fetch_object($result)) { + $matches[$user->name] = check_plain($user->name); + } } print drupal_to_js($matches); exit(); -- cgit v1.2.3