diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-04-10 10:30:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 10:30:08 +0300 |
commit | 8701e0973450da9c3c1dd905e73011bdeb09c93e (patch) | |
tree | aecadf995f0174cc41f7cb9846a1382a930d8f82 /indra/newview/llsearchhistory.cpp | |
parent | 37392be4171303db08a4842b7882b4cb758a8f8d (diff) | |
parent | 8fa956a16e616191e21bf001eabc4670453debcd (diff) |
Merge pull request #1178 from secondlife/marchcat/b-merge
Release (Maint W) -> Maint B merge
Diffstat (limited to 'indra/newview/llsearchhistory.cpp')
-rw-r--r-- | indra/newview/llsearchhistory.cpp | 11 |
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()) |