diff --git a/Library/Measure.cpp b/Library/Measure.cpp index 6a5e7fa5..aee513ba 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -758,6 +758,10 @@ void CMeasure::DoChangeAction(bool execute) { double newValue = GetValue(); const WCHAR* newStringValue = GetStringValue(); + if (!newStringValue) + { + newStringValue = L""; + } if (!m_OldValue) { diff --git a/Library/Measure.h b/Library/Measure.h index 183424d3..91abe170 100644 --- a/Library/Measure.h +++ b/Library/Measure.h @@ -40,34 +40,9 @@ enum AUTOSCALE class CMeasureValueSet { public: - CMeasureValueSet(double val, const WCHAR* str) : m_Value(val), m_StringValue(str ? str : L"") {} - - void Set(double val, const WCHAR* str) - { - m_Value = val; - if (str) - { - m_StringValue = str; - } - else - { - m_StringValue.clear(); - } - } - - bool IsChanged(double val, const WCHAR* str) - { - if (m_Value != val || - (!str && !m_StringValue.empty()) || - (str && wcscmp(m_StringValue.c_str(), str) != 0)) - { - Set(val, str); - return true; - } - - return false; - } - + CMeasureValueSet(double val, const WCHAR* str) : m_Value(val), m_StringValue(str) {} + void Set(double val, const WCHAR* str) { m_Value = val; m_StringValue = str; } + bool IsChanged(double val, const WCHAR* str) { if (m_Value != val || wcscmp(m_StringValue.c_str(), str) != 0) { Set(val, str); return true; } return false; } private: double m_Value; std::wstring m_StringValue;