Philipp Hörist pushed to branch master at gajim / gajim


Commits:
40aba5bd by Philipp Hörist at 2024-05-02T20:12:28+02:00
cfix: ArchiveStorage: Don’t fail there is no message found

Fixes #11817

- - - - -


1 changed file:

- gajim/common/storage/archive/storage.py


Changes:

=====================================
gajim/common/storage/archive/storage.py
=====================================
@@ -327,10 +327,11 @@ def get_message_with_id(
         )
 
         result = session.scalars(stmt).all()
-        if len(result) > 1:
-            self._log.warning('Found >1 message with message id %s', 
message_id)
-            return None
-        return result[0]
+        if len(result) == 1:
+            return result[0]
+
+        self._log.warning('Found more than one message with message id %s', 
message_id)
+        return None
 
     @with_session
     @timeit
@@ -352,10 +353,11 @@ def get_message_with_stanza_id(
         )
 
         result = session.scalars(stmt).all()
-        if len(result) > 1:
-            self._log.warning('Found >1 message with stanza id %s', stanza_id)
-            return None
-        return result[0]
+        if len(result) == 1:
+            return result[0]
+
+        self._log.warning('Found more than one message with stanza id %s', 
stanza_id)
+        return None
 
     @with_session
     @timeit



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/40aba5bde85bc98b224b7b8a66ac3a64c547af34

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/40aba5bde85bc98b224b7b8a66ac3a64c547af34
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to