Skip to content

Commit

Permalink
MC-39765: No such entity with addressId, occurs randomly on visitors …
Browse files Browse the repository at this point in the history
…browser. System Log Generated
  • Loading branch information
OlgaVasyltsun committed Dec 16, 2020
1 parent 3bb857f commit 92ecbbf
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
$customer = $this->customerRepository->getById($this->_persistentSession->getSession()->getCustomerId());
if ($defaultShipping = $customer->getDefaultShipping()) {
$address = $this->getCustomerAddressById($defaultShipping);
$address = $this->getCustomerAddressById((int) $defaultShipping);

if ($address !== null) {
$this->_customerSession->setDefaultTaxShippingAddress(
Expand All @@ -103,7 +103,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
}

if ($defaultBilling = $customer->getDefaultBilling()) {
$address = $this->getCustomerAddressById($defaultBilling);
$address = $this->getCustomerAddressById((int) $defaultBilling);

if ($address !== null) {
$this->_customerSession->setDefaultTaxBillingAddress([
Expand All @@ -127,7 +127,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
* @param int $addressId
* @return \Magento\Customer\Api\Data\AddressInterface|null
*/
private function getCustomerAddressById($addressId)
private function getCustomerAddressById(int $addressId)
{
try {
return $this->addressRepository->getById($addressId);
Expand Down

0 comments on commit 92ecbbf

Please sign in to comment.