From 6ef362c3dfc354c7051f75506791ad7b0625d434 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Mon, 2 Aug 2021 14:39:42 +0200
Subject: [PATCH] corrected bug where apply was processed when there was
 nothing to produce

---
 decoder/src/Producer.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/decoder/src/Producer.cpp b/decoder/src/Producer.cpp
index 711d57d..b0925ed 100644
--- a/decoder/src/Producer.cpp
+++ b/decoder/src/Producer.cpp
@@ -68,6 +68,9 @@ Producer::Producer(std::filesystem::path input, std::filesystem::path output) :
 // Returns false if we are finished and true if we have events remaining.
 bool Producer::apply(BaseConfig & config)
 {
+  if (not parser.hasNext())
+    return false;
+
   auto text = util::splitAsUtf8(parser.getCurrentNodeText());
   if (text.empty())
     util::error("Trying to add empty text to raw input.");
-- 
GitLab