From da83fb44aed1af80dc0249daa2d73332a84ca9a2 Mon Sep 17 00:00:00 2001 From: Jakob Truelsen Date: Tue, 23 Jan 2024 14:39:56 +0100 Subject: [PATCH] fix reading of empty serialized btrees --- tpie/btree/serialized_store.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tpie/btree/serialized_store.h b/tpie/btree/serialized_store.h index 20764ed47..11568b75c 100644 --- a/tpie/btree/serialized_store.h +++ b/tpie/btree/serialized_store.h @@ -398,8 +398,9 @@ class serialized_store { metadata_size = h.metadata_size; set_flags(h.flags); - - if (m_height == 1) { + if (m_height == 0) { + root_leaf = leaf_type(0); + } else if (m_height == 1) { root_leaf = leaf_type(h.root); f->seekg(h.root); unserialize(*f, *root_leaf);