From bdde56d14ac77ecb31db3e0ea30275903e67d719 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Mon, 5 Feb 2024 14:29:08 +0100
Subject: [PATCH] mmcir writer: bugfix

---
 modules/io/src/mol/mmcif_writer.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc
index 4f00ef22a..327622313 100644
--- a/modules/io/src/mol/mmcif_writer.cc
+++ b/modules/io/src/mol/mmcif_writer.cc
@@ -1457,9 +1457,12 @@ MMCifWriterEntity MMCifWriterEntity::FromPolymer(const String& entity_poly_type,
     if(ent.seq_olcs.back().size() == 1) {
       ent.seq_can_olcs.push_back(ent.seq_olcs.back());
     } else {
+      char olc = '?';
       ost::conop::CompoundPtr compound = 
       compound_lib->FindCompound(mon_id, ost::conop::Compound::PDB);
-      char olc = compound->GetOneLetterCode();
+      if(compound) {
+        olc = compound->GetOneLetterCode();
+      }
       if(olc < 'A' || olc > 'Z') {
         ent.seq_can_olcs.push_back("(" + mon_id + ")");  
       } else {
-- 
GitLab