From a88d80a43209ac2fd644cd6bda176d90375bec26 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 7 Jun 2022 13:59:02 +1000 Subject: [PATCH] Filter empty entries when restoring HistoryRegisters Saving registers will create a single empty entry due to the way StaticRegister::get works. We do not really want those to be restored --- src/register_manager.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/register_manager.cc b/src/register_manager.cc index 7bd1d7f9..6dc92006 100644 --- a/src/register_manager.cc +++ b/src/register_manager.cc @@ -34,7 +34,11 @@ void HistoryRegister::set(Context& context, ConstArrayView values, bool constexpr size_t size_limit = 100; if (restoring) - return StaticRegister::set(context, values, true); + { + StaticRegister::set(context, values, true); + m_content.erase(remove_if(m_content, [](auto&& s) { return s.empty(); }), m_content.end()); + return; + } for (auto& entry : values) {