Skip to content

Commit

Permalink
fix: handle null value
Browse files Browse the repository at this point in the history
  • Loading branch information
uhrjun committed Jul 22, 2024
1 parent b2cb390 commit e104dd0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drive/api/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_max_storage():
"""
plan_limit = frappe.conf.get("plan_limit")
if plan_limit:
limit = plan_limit['max_storage_usage']
limit = plan_limit["max_storage_usage"]
limit = int(limit)
return int(limit * 1024**2)

Expand Down Expand Up @@ -51,7 +51,8 @@ def total_storage_used_by_file_kind():
def get_storage_allowed():
limit = get_max_storage()
usage = total_storage_used()
return limit - usage[0].total_size
usage = usage[0].total_size or 0
return limit - usage


def total_disk_storage_used():
Expand Down

0 comments on commit e104dd0

Please sign in to comment.