From 1fdb33ed0346fbda021c20552081f2022b44707b Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Sat, 30 Dec 2023 16:45:31 +0100
Subject: [PATCH] mmcif writer: Don't write loops that contain no data

The previous behaviour was to just write the loop header, followed by nothing
---
 modules/io/src/mol/star_writer.hh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/io/src/mol/star_writer.hh b/modules/io/src/mol/star_writer.hh
index b09f2109b..ea4a396d3 100644
--- a/modules/io/src/mol/star_writer.hh
+++ b/modules/io/src/mol/star_writer.hh
@@ -204,6 +204,9 @@ public:
   }
 
   virtual void ToStream(std::ostream& s) {
+    if(data_.empty()) {
+      return; // skip loop, including header
+    }
     s << "loop_" << std::endl;
     desc_.ToStream(s);
     int desc_size = desc_.GetSize();
-- 
GitLab