File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ class UnirecOutputInterface {
137137 ur_template_t * m_template = nullptr ;
138138 uint8_t m_interfaceID;
139139 bool m_sendEoFonExit;
140+ bool m_isInitialized;
140141 UnirecRecord m_unirecRecord;
141142
142143 friend class Unirec ;
Original file line number Diff line number Diff line change @@ -17,12 +17,13 @@ UnirecOutputInterface::UnirecOutputInterface(uint8_t interfaceID)
1717 : m_template(nullptr )
1818 , m_interfaceID(interfaceID)
1919 , m_sendEoFonExit(true )
20+ , m_isInitialized(false )
2021{
2122}
2223
2324UnirecOutputInterface::~UnirecOutputInterface ()
2425{
25- if (m_sendEoFonExit) {
26+ if (m_sendEoFonExit && m_isInitialized ) {
2627 sendEoF ();
2728 }
2829
@@ -88,7 +89,7 @@ void UnirecOutputInterface::setAutoflushTimeout(int timeout)
8889
8990void UnirecOutputInterface::sendEoF () const
9091{
91- char dummy[1 ] = {0 };
92+ char dummy[1 ] = { 0 };
9293 trap_send (m_interfaceID, dummy, sizeof (dummy));
9394}
9495
@@ -116,6 +117,8 @@ void UnirecOutputInterface::changeTemplate(const std::string& templateFields)
116117 " created." );
117118 }
118119 m_unirecRecord = createUnirecRecord ();
120+
121+ m_isInitialized = true ;
119122}
120123
121124UnirecRecord UnirecOutputInterface::createUnirecRecord (size_t maxVariableFieldsSize)
You can’t perform that action at this time.
0 commit comments