[-] FO: Fix fatal error when a customer is deleted and still logged

This commit is contained in:
Rémi Gaillard
2013-02-06 11:56:23 +01:00
parent 7b7b964f6a
commit 588276cfb1
+12 -6
View File
@@ -164,15 +164,21 @@ else
if (isset($cookie->id_customer) && (int)$cookie->id_customer)
{
$customer = new Customer($cookie->id_customer);
$customer->logged = $cookie->logged;
if ($customer->id_lang != $context->language->id)
if(!Validate::isLoadedObject($customer))
$customer->logout();
else
{
$customer->id_lang = $context->language->id;
$customer->update();
$customer->logged = $cookie->logged;
if ($customer->id_lang != $context->language->id)
{
$customer->id_lang = $context->language->id;
$customer->update();
}
}
}
else
if (!isset($customer) || !Validate::isLoadedObject($customer))
{
$customer = new Customer();