Skip to content

Commit 60fdb9c

Browse files
committed
Fixes
1 parent 88cf8c5 commit 60fdb9c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ipinfo/handler_utils.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,19 @@ def read_coords(location):
9696
return lat, lon
9797

9898

99-
def read_json_file(json_file, default_value=None):
99+
def read_json_file(json_file):
100100
try:
101-
json_file = os.path.join(os.path.dirname(__file__), json_file)
102-
with open(json_file, encoding="utf8") as f:
101+
if not json_file:
102+
return None
103+
json_file_path = os.path.join(os.path.dirname(__file__), json_file)
104+
with open(json_file_path, encoding="utf8") as f:
103105
json_data = f.read()
106+
if not json_data:
107+
return None
104108
return json.loads(json_data)
109+
105110
except FileNotFoundError:
106-
return default_value
111+
return None
107112

108113

109114
def return_or_fail(raise_on_fail, e, v):

0 commit comments

Comments
 (0)