summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-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())