From 23d7bef4762a8bc21bb1ad926f76ce5ba7ccd210 Mon Sep 17 00:00:00 2001
From: rinkk <karsten.rink@ufz.de>
Date: Thu, 27 Jul 2017 17:57:15 +0200
Subject: [PATCH] added checks for output in csv writer

---
 Applications/Utils/SWMMConverter/SWMMConverter.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Applications/Utils/SWMMConverter/SWMMConverter.cpp b/Applications/Utils/SWMMConverter/SWMMConverter.cpp
index 57a6017499e..8515288a880 100644
--- a/Applications/Utils/SWMMConverter/SWMMConverter.cpp
+++ b/Applications/Utils/SWMMConverter/SWMMConverter.cpp
@@ -111,6 +111,18 @@ int writeCsvOutput(std::string input_file, std::string output_file,
     if (swmm == nullptr)
         return -1;
 
+    if (!swmm->existsSwmmOutputFile())
+    {
+        INFO("No output file found, skipping data conversion to CSV.");
+        return -1;
+    }
+
+    if (!(node_args || link_args || catchment_args || system_args))
+    {
+        INFO("No data category selected. Nothing to write.");
+        return 0;
+    }
+
     std::string const basename = BaseLib::dropFileExtension(output_file);
     std::string const extension = std::string("." + BaseLib::getFileExtension(output_file));
 
-- 
GitLab