diff --git a/vendor/magento/module-persistent-history/Model/CustomerEmulator.php b/vendor/magento/module-persistent-history/Model/CustomerEmulator.php
index b7055260284..92dd0844105 100644
--- a/vendor/magento/module-persistent-history/Model/CustomerEmulator.php
+++ b/vendor/magento/module-persistent-history/Model/CustomerEmulator.php
@@ -5,8 +5,10 @@
  */
 namespace Magento\PersistentHistory\Model;
 
+use \Magento\Framework\Exception\NoSuchEntityException;
+
 /**
- * Class CustomerEmulator
+ * Emulates customer
  */
 class CustomerEmulator
 {
@@ -98,10 +100,11 @@ class CustomerEmulator
     }
 
     /**
-     * Emulate cutomer
+     * Emulate customer
      *
      * @return void
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+     * @SuppressWarnings(PHPMD.NPathComplexity)
      */
     public function emulate()
     {
@@ -110,8 +113,9 @@ class CustomerEmulator
         /** @var \Magento\Customer\Model\Customer $customer */
         $customer = $this->_customerFactory->create()->load($customerId);
         if ($defaultShipping = $customer->getDefaultShipping()) {
-            $address = $this->addressRepository->getById($defaultShipping);
-            if ($address) {
+            $address = $this->getCustomerAddressById((int) $defaultShipping);
+
+            if ($address !== null) {
                 $this->_customerSession->setDefaultTaxShippingAddress(
                     [
                         'country_id' => $address->getCountryId(),
@@ -125,9 +129,9 @@ class CustomerEmulator
         }
 
         if ($defaultBilling = $customer->getDefaultBilling()) {
-            /** @var  \Magento\Customer\Model\Data\Address $address */
-            $address = $this->addressRepository->getById($defaultBilling);
-            if ($address) {
+            $address = $this->getCustomerAddressById((int) $defaultBilling);
+
+            if ($address !== null) {
                 $this->_customerSession->setDefaultTaxBillingAddress([
                     'country_id' => $address->getCountryId(),
                     'region_id' => $address->getRegion() ? $address->getRegionId() : null,
@@ -158,6 +162,8 @@ class CustomerEmulator
     }
 
     /**
+     * Returns compare product helper
+     *
      * @return \Magento\Catalog\Helper\Product\Compare
      * @deprecated 100.1.0
      */
@@ -169,4 +175,19 @@ class CustomerEmulator
         }
         return $this->compareProductHelper;
     }
+
+    /**
+     * Returns customer address by id
+     *
+     * @param int $addressId
+     * @return \Magento\Customer\Api\Data\AddressInterface|null
+     */
+    private function getCustomerAddressById(int $addressId)
+    {
+        try {
+            return $this->addressRepository->getById($addressId);
+        } catch (NoSuchEntityException $exception) {
+            return null;
+        }
+    }
 }
