summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-11-09 13:21:02 +0000
committeralecpl <alec@alec.pl>2010-11-09 13:21:02 +0000
commit6d99f995766d32e6074201b847adf3ce7e5b0dbf (patch)
treec1b1a629b243efa868e8e42588866a67ec13674e /index.php
parentad5881162d1a06b18c045cf2c81826f2d1be1b1e (diff)
- Handle situation when $IMAP object isn't initialized on log in
Diffstat (limited to 'index.php')
-rw-r--r--index.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/index.php b/index.php
index e87c9c958..f1e5ac1d0 100644
--- a/index.php
+++ b/index.php
@@ -118,9 +118,11 @@ if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') {
$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();
}
}