? masquerade_ignore_anonymous_users.patch Index: masquerade.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/masquerade/masquerade.module,v retrieving revision 1.16.2.39 diff -u -p -r1.16.2.39 masquerade.module --- masquerade.module 23 Jun 2010 13:33:34 -0000 1.16.2.39 +++ masquerade.module 24 Jun 2010 12:11:06 -0000 @@ -34,6 +34,10 @@ function masquerade_perm() { function masquerade_init() { global $user; + if (empty($user->uid)) { + return; + } + // load from table uid + session id $uid = db_result(db_query("SELECT uid_from FROM {masquerade} WHERE sid = '%s' AND uid_as = %d", session_id(), $user->uid)); // using if so that we get unset rather than false if not masqing @@ -632,7 +636,7 @@ function masquerade_switch_user_page($ui */ function masquerade_switch_user($uid) { global $user; - if (!is_numeric($uid)) { + if (!is_numeric($uid) || empty($uid)) { drupal_set_message(t('A user id was not correctly passed to the switching function.')); watchdog('masquerade', 'The user id provided to switch users was not numeric.', NULL, WATCHDOG_ERROR); return drupal_goto(referer_uri());