Skip to content

Commit

Permalink
improved null checking and handling to prevent iterating over none
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxwell-Lindsey committed Feb 27, 2024
1 parent 5d1168a commit ee5509b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ai_ta_backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def appendDocumentToGroup():
doc_group = data['doc_group']

document_data = data.get('document', {})
document_data['doc_groups'] = [group for group in document_data.get('doc_groups', []) if group is not None]
document_data['doc_groups'] = [group for group in (document_data.get('doc_groups') or []) if group is not None]

try:
document = MaterialDocument(**document_data)
Expand All @@ -766,7 +766,7 @@ def removeDocumentFromGroup():
doc_group = data['doc_group']

document_data = data.get('document', {})
document_data['doc_groups'] = [group for group in document_data.get('doc_groups', []) if group is not None]
document_data['doc_groups'] = [group for group in (document_data.get('doc_groups') or []) if group is not None]

try:
document = MaterialDocument(**document_data)
Expand Down

0 comments on commit ee5509b

Please sign in to comment.