Skip to content

Commit

Permalink
Fix issue with non-existing packs/sounds in downloads modal
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Oct 31, 2023
1 parent 7fd0e0c commit d87f145
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,9 @@ def downloaded_sounds(request, username):
sounds_dict = Sound.objects.dict_ids(sound_ids)
download_list = []
for d in page:
download_list.append({"created": d.created, "sound": sounds_dict[d.sound_id]})
sound = sounds_dict.get(d.sound_id, None)
if sound is not None:
download_list.append({"created": d.created, "sound": sound})
tvars = {"username": username,
"user": user,
"download_list": download_list,
Expand Down Expand Up @@ -1212,7 +1214,9 @@ def downloaded_packs(request, username):
packs_dict = Pack.objects.dict_ids(pack_ids)
download_list = []
for d in page:
download_list.append({"created": d.created, "pack": packs_dict[d.pack_id]})
pack = packs_dict.get(d.pack_id, None)
if pack is not None:
download_list.append({"created": d.created, "pack": pack})
tvars = {"username": username,
"download_list": download_list,
"type_sounds": False}
Expand Down

0 comments on commit d87f145

Please sign in to comment.