From 9d969d79d9f3eb887d0e57e7bf04b00d8f4e6267 Mon Sep 17 00:00:00 2001
From: Holger Nahrstaedt <holgernahrstaedt@gmx.de>
Date: Sat, 9 Jun 2018 06:35:28 +0200
Subject: [PATCH] Fix handling of empty json_metadata

---
 beem/account.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/beem/account.py b/beem/account.py
index bc315aa3..259c59eb 100644
--- a/beem/account.py
+++ b/beem/account.py
@@ -210,6 +210,8 @@ class Account(BlockchainObject):
     def profile(self):
         """ Returns the account profile
         """
+        if self["json_metadata"] == '':
+            return {}
         metadata = json.loads(self["json_metadata"])
         if "profile" in metadata:
             return json.loads(self["json_metadata"])["profile"]
@@ -1543,7 +1545,10 @@ class Account(BlockchainObject):
         if not isinstance(profile, dict):
             raise ValueError("Profile must be a dict type!")
         account = Account(account, steem_instance=self.steem)
-        metadata = json.loads(self['json_metadata'])
+        if self['json_metadata'] == '':
+            metadata = {}
+        else:
+            metadata = json.loads(self['json_metadata'])
         metadata["profile"] = profile
         return self.update_account_metadata(metadata)
 
-- 
GitLab