From ad8fa216a576db75290c62d8d1b87c1ddd42c8b4 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Fri, 9 Nov 2018 16:08:25 -0500 Subject: [PATCH] fix: Fixed NullReferenceException when writing null strings to CSV --- CHANGELOG.md | 1 + ICD.Common.Utils/Csv/CsvWriter.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08db5e2..1a0846a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Performance improvements when working with xml attributes + - Fixed NullReferenceException when writing null strings to CSV ### Removed - Removed IcdXmlAttribute diff --git a/ICD.Common.Utils/Csv/CsvWriter.cs b/ICD.Common.Utils/Csv/CsvWriter.cs index 0911129..d07429c 100644 --- a/ICD.Common.Utils/Csv/CsvWriter.cs +++ b/ICD.Common.Utils/Csv/CsvWriter.cs @@ -79,6 +79,8 @@ namespace ICD.Common.Utils.Csv [PublicAPI] public void AppendValue(string value) { + value = value ?? string.Empty; + if (!m_NewLine) m_Writer.WrappedTextWriter.Write(m_Seperator);