changeset 587:9b93aa085073 find-refactoring tip

fix reading attachments revision from older versions
author Alain Mazy <am@orthanc.team>
date Tue, 05 Nov 2024 11:19:59 +0100
parents 3b1070dcab2f
children
files Framework/Plugins/IndexBackend.cpp
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Mon Nov 04 22:52:58 2024 +0100
+++ b/Framework/Plugins/IndexBackend.cpp	Tue Nov 05 11:19:59 2024 +0100
@@ -3913,7 +3913,14 @@
           attachment->set_compressed_size(statement->ReadInteger64(C9_BIG_INT_1));
           attachment->set_uncompressed_size(statement->ReadInteger64(C10_BIG_INT_2));
 
-          responses[internalId]->add_attachments_revisions(statement->ReadInteger32(C8_INT_3));
+          if (!statement->IsNull(C8_INT_3))  // revision can be null for files that have been atttached by older Orthanc versions
+          {
+            responses[internalId]->add_attachments_revisions(statement->ReadInteger32(C8_INT_3));
+          }
+          else
+          {
+            responses[internalId]->add_attachments_revisions(0);
+          }
         }; break;
 
         case QUERY_METADATA: