diff --git a/include/caosdb/protobuf_helper.h b/include/caosdb/protobuf_helper.h
index ff8fc15e3a96fb184c91fc6293a116304fb99402..4dfc11c396ded34db6bb2cbed2c938a5402dd7c7 100644
--- a/include/caosdb/protobuf_helper.h
+++ b/include/caosdb/protobuf_helper.h
@@ -58,7 +58,11 @@ public:
    * serialization.
    */
   inline auto operator==(const ProtoMessageWrapper<P> &other) const noexcept -> bool {
-    return this->wrapped->SerializeAsString() == other.wrapped->SerializeAsString();
+    if (this->wrapped != nullptr && other.wrapped != nullptr) {
+      return this->wrapped->SerializeAsString() == other.wrapped->SerializeAsString();
+    }
+    // both nullptr?
+    return this->wrapped == other.wrapped;
   }
 
   /**
@@ -66,7 +70,11 @@ public:
    * serialization.
    */
   inline auto operator!=(const ProtoMessageWrapper<P> &other) const noexcept -> bool {
-    return this->wrapped->SerializeAsString() != other.wrapped->SerializeAsString();
+    if (this->wrapped != nullptr && other.wrapped != nullptr) {
+      return this->wrapped->SerializeAsString() != other.wrapped->SerializeAsString();
+    }
+    // only one is nullptr?
+    return this->wrapped != other.wrapped;
   }
 
 protected: