I am running an update on my customer list. In this i am retrieving the customer telephone number using
$telephone_number = $customer->getPrimaryBillingAddress()->getTelephone();
If the customer doesn't has any address there were an error message like below
Fatal error: Call to a member function getTelephone() on a non-object in /var/www/vhosts/abc.com/public_html/custxxxxxxxx_XXX.php on line 44
I understood that this error is coming because of the customer doesn't have any address. so before using
$telephone_number = $customer->getPrimaryBillingAddress()->getTelephone();
is there any way to check the customer has any address?