LibLine: Restore previous state only if initialized

This makes the library safe to construct/destruct without actually using
it.
This commit is contained in:
AnotherTest 2020-04-02 01:29:48 +04:30 committed by Andreas Kling
parent cd1d369cdd
commit 8f08ec5038
Notes: sideshowbarker 2024-07-19 08:00:18 +09:00

View file

@ -44,6 +44,7 @@ Editor::Editor()
Editor::~Editor() Editor::~Editor()
{ {
if (m_initialized)
tcsetattr(0, TCSANOW, &m_default_termios); tcsetattr(0, TCSANOW, &m_default_termios);
} }