From 0efe781bc4fe0e2cec7bfd8e15f5947c5a6a652b Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Fri, 12 Apr 2024 08:42:54 +0200
Subject: [PATCH] fix crash on null collection

---
 scipost_django/submissions/forms/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scipost_django/submissions/forms/__init__.py b/scipost_django/submissions/forms/__init__.py
index 8021a379f..c23dae5f4 100644
--- a/scipost_django/submissions/forms/__init__.py
+++ b/scipost_django/submissions/forms/__init__.py
@@ -1620,7 +1620,10 @@ class SubmissionForm(forms.ModelForm):
         at least one of the authors in the list is an expected author of the collection.
         """
         # Check if no collection is selected or fetch the object
-        collection_id = self.cleaned_data.get("collection", "")
+        collection_id = self.cleaned_data.get("collection", None)
+        if collection_id is None:
+            return
+
         collection = get_object_or_404(Collection, id=collection_id)
 
         # Check that the collection is part of a series in the target journal
-- 
GitLab