From ecbffc05f7ce9d0d43b808dcb26a9985c1e77304 Mon Sep 17 00:00:00 2001 From: Carl Philipp Klemm <philipp@uvos.xyz> Date: Mon, 15 Jul 2024 14:33:13 +0200 Subject: [PATCH] EisSpectra: Avoid Null in file when model string is empty --- spectra.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spectra.cpp b/spectra.cpp index 48ae751..a9af27b 100644 --- a/spectra.cpp +++ b/spectra.cpp @@ -118,7 +118,7 @@ void EisSpectra::saveToStream(std::ostream& stream) const stream<<F_MAGIC<<", "<<std::to_string(F_VERSION_MAJOR)<<'.' <<std::to_string(F_VERSION_MINOR)<<'.'<<std::to_string(F_VERSION_PATCH)<<'\n'; - stream<<'"'<<model<<'"'<<'\n'<<(headerDescription.empty() ? "None" : headerDescription)<<'\n'<<(header.empty() ? "None" : header); + stream<<'"'<<(model.empty() ? "None" : model)<<'"'<<'\n'<<(headerDescription.empty() ? "None" : headerDescription)<<'\n'<<(header.empty() ? "None" : header); if(!labels.empty()) { @@ -192,7 +192,7 @@ EisSpectra EisSpectra::loadFromStream(std::istream& stream) if(fileVersion.minor == F_VERSION_MINOR) { std::getline(stream, line); - out.model = line; + out.model = line == "None" ? "" : line; std::getline(stream, line); out.headerDescription = line == "None" ? "" : line; std::getline(stream, line); -- GitLab