From c984afdf47ef31511024c6b70bd4b4c4e64f56a6 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 8 Jul 2023 23:30:25 +0500 Subject: Fixed some errors detected by static analysis --- src/Settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Settings.cpp') diff --git a/src/Settings.cpp b/src/Settings.cpp index a585752..5287556 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -23,7 +23,7 @@ void Settings::Load() { stream >> j; for (json::iterator it = j.begin(); it != j.end(); ++it) { - values.insert(std::make_pair(it.key(), it->get())); + values.try_emplace(it.key(), it->get()); } LOG(INFO) << "Loaded " << values.size() << " settings"; } @@ -47,7 +47,7 @@ void Settings::Save() { std::string Settings::Read(const std::string &key, const std::string &defaultValue) { auto it = values.find(key); if (it == values.end()) { - values.insert(std::make_pair(key, defaultValue)); + values.try_emplace(key, defaultValue); it = values.find(key); } return it->second; -- cgit v1.2.3