2 files changed, 5 insertions(+), 1 deletions(-)

M nosqlite.py
M tests.py
M nosqlite.py +1 -1
@@ 614,7 614,7 @@ def _eq(field: str, value: Any, document
     """
     try:
         return document.get(field, None) == value
-    except TypeError:
+    except (TypeError, AttributeError):
         return False
 
 

          
M tests.py +4 -0
@@ 728,6 728,10 @@ class TestCollection:
         document = {"foo": 5}
         assert not nosqlite._eq("foo", "bar", document)
 
+    def test_eq_attribute_error(self):
+        document = None  # This will trigger AttributeError in _eq function
+        assert not nosqlite._eq("foo", "bar", document)
+
     def test_gt_type_error(self):
         document = {"foo": "bar"}
         assert not nosqlite._gt("foo", 5, document)