Permalink
Browse files

- Handle situation when $IMAP object isn't initialized on log in

  • Loading branch information...
1 parent ad58811 commit 6d99f995766d32e6074201b847adf3ce7e5b0dbf @alecpl alecpl committed Nov 9, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 index.php
View
@@ -118,9 +118,11 @@
$OUTPUT->redirect($redir);
}
else {
- $OUTPUT->show_message($IMAP->get_error_code() < -1 ? 'imaperror' : 'loginfailed', 'warning');
+ $error_code = is_object($IMAP) ? $IMAP->get_error_code() : -1;
+
+ $OUTPUT->show_message($error_code < -1 ? 'imaperror' : 'loginfailed', 'warning');
$RCMAIL->plugins->exec_hook('login_failed', array(
- 'code' => $IMAP->get_error_code(), 'host' => $auth['host'], 'user' => $auth['user']));
+ 'code' => $error_code, 'host' => $auth['host'], 'user' => $auth['user']));
$RCMAIL->kill_session();
}
}

0 comments on commit 6d99f99

Please sign in to comment.