Check list length before accessing 1st element (#324)

This commit is contained in:
Ondrej Calda 2020-05-17 05:52:06 +02:00 committed by GitHub
parent 93e066da14
commit 7a64fd92e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,7 +172,7 @@ def bitcoind_status_page():
local_address = "..." local_address = "..."
if networkdata != None: if networkdata != None:
local_address = "not none" local_address = "not none"
if "localaddresses" in networkdata: if ("localaddresses" in networkdata) and (len(networkdata["localaddresses"]) > 0):
local_address = "{}:{}".format(networkdata["localaddresses"][0]["address"], networkdata["localaddresses"][0]["port"]) local_address = "{}:{}".format(networkdata["localaddresses"][0]["address"], networkdata["localaddresses"][0]["port"])
# Balance # Balance