From 69f55224928c188b267781e0504bfd465069668e Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 27 Jan 2019 08:49:08 -0500 Subject: [PATCH] dont allow root modifiy --- extensions/replacer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extensions/replacer.cpp b/extensions/replacer.cpp index a110850..5bc831a 100644 --- a/extensions/replacer.cpp +++ b/extensions/replacer.cpp @@ -14,13 +14,12 @@ struct public: void Put(std::wstring original, std::wstring replacement) { - if (original.empty()) return; Node* current = &root; for (auto c : original) if (Ignore(c)); else if (auto& next = current->next[c]) current = next.get(); else current = (next = std::make_unique()).get(); - current->value = replacement; + if (current != &root) current->value = replacement; } std::pair Lookup(const std::wstring& text)