From a2ed13645cb5218966fde79ff7713629511348e5 Mon Sep 17 00:00:00 2001
From: Ihor Sviziev <ihor-sviziev@users.noreply.github.com>
Date: Tue, 17 Mar 2015 16:02:41 +0200
Subject: [PATCH] Customer model - getPrimaryAddresses without primary billing
 address - Fix for issue #1096

---
 app/code/Magento/Customer/Model/Customer.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php
index 67327f1012e..abf0180b52b 100644
--- a/app/code/Magento/Customer/Model/Customer.php
+++ b/app/code/Magento/Customer/Model/Customer.php
@@ -719,7 +719,7 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel
 
         $primaryShipping = $this->getPrimaryShippingAddress();
         if ($primaryShipping) {
-            if ($primaryBilling->getId() == $primaryShipping->getId()) {
+            if ($primaryBilling && $primaryBilling->getId() == $primaryShipping->getId()) {
                 $primaryBilling->setIsPrimaryShipping(true);
             } else {
                 $primaryShipping->setIsPrimaryShipping(true);
-- 
GitLab