diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-04-10 10:29:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 10:29:47 +0300 |
commit | 5118ba7adfc6f49f5b23694507dc7ceb8365b969 (patch) | |
tree | 4e499acfe5617682c5eca52998b5c10cdac8609a /indra/newview/llsearchhistory.cpp | |
parent | 16e638db975278f6018fe1e21ba1954b7f159149 (diff) | |
parent | 84dfe55810815e8c274044cea5c81aaed89a787f (diff) |
Merge pull request #1179 from secondlife/marchcat/y-merge
Release (Maint W) -> Maint YZ 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()) |