summaryrefslogtreecommitdiff
path: root/indra/newview/llsearchhistory.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-10 06:57:52 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-10 07:08:25 +0300
commit84dfe55810815e8c274044cea5c81aaed89a787f (patch)
tree4e499acfe5617682c5eca52998b5c10cdac8609a /indra/newview/llsearchhistory.cpp
parent16e638db975278f6018fe1e21ba1954b7f159149 (diff)
parentda9a1dcb55548a249ff7a1255f3e518696b81245 (diff)
Merge branch 'main' into marchcat/y-merge
# Conflicts: # autobuild.xml # indra/llcommon/llsys.cpp
Diffstat (limited to 'indra/newview/llsearchhistory.cpp')
-rw-r--r--indra/newview/llsearchhistory.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/indra/newview/llsearchhistory.cpp b/indra/newview/llsearchhistory.cpp
index 449e0080f0..66e377cb8d 100644
--- a/indra/newview/llsearchhistory.cpp
+++ b/indra/newview/llsearchhistory.cpp
@@ -75,6 +75,17 @@ bool LLSearchHistory::save()
{
// build filename for each user
std::string resolved_filename = getHistoryFilePath();
+
+ // delete the file if it is empty or contains only empty entries
+ if (std::find_if(mSearchHistory.begin(), mSearchHistory.end(), [](const LLSearchHistoryItem& x)
+ {
+ return !x.search_query.empty();
+ }) == mSearchHistory.end())
+ {
+ remove(resolved_filename.c_str());
+ return true;
+ }
+
// open a file for writing
llofstream file(resolved_filename.c_str());
if (!file.is_open())