From f4e84f62a466858bd0ab3fc382891e921dca32d0 Mon Sep 17 00:00:00 2001
From: PCoder <purple.coder@yahoo.co.uk>
Date: Wed, 1 Jan 2020 01:28:35 +0530
Subject: [PATCH] Save billing address only if billing_address exists

---
 hosting/views.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hosting/views.py b/hosting/views.py
index 9d975df1..24da0ba9 100644
--- a/hosting/views.py
+++ b/hosting/views.py
@@ -663,7 +663,8 @@ class SettingsView(LoginRequiredMixin, FormView):
                             extra_tags='error'
                         )
                         billing_address = current_billing_address
-                        billing_address.save()
+                        if billing_address:
+                            billing_address.save()
                         email_data = {
                             'subject': "%s updated VAT number to %s but failed" %
                                        (request.user.email, vat_number),