diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-10-01 18:21:05 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-10-01 19:29:51 +0300 |
commit | 1dffd2a2fe8b2c0835460b84fd63fd19aa74d890 (patch) | |
tree | 0a050ca10184a8bdd6c12dbc52856057ac26bcd9 /indra/newview/llinventorymodel.cpp | |
parent | 37e5a0b6629545ab58fe437d81514e5ce928715e (diff) |
SL-13934 Crash at saveToFile #2
More detailed stream handling and logging
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 5abc335d39..72281d9e4c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2808,13 +2808,19 @@ bool LLInventoryModel::saveToFile(const std::string& filename, llofstream fileXML(filename.c_str()); if (!fileXML.is_open()) { - LL_WARNS(LOG_INV) << "unable to save inventory to: " << filename << LL_ENDL; + LL_WARNS(LOG_INV) << "Failed to open file. Unable to save inventory to: " << filename << LL_ENDL; return false; } LLSD cache_ver; cache_ver["inv_cache_version"] = sCurrentInvCacheVersion; + if (fileXML.fail()) + { + LL_WARNS(LOG_INV) << "Failed to write cache version to file. Unable to save inventory to: " << filename << LL_ENDL; + return false; + } + fileXML << LLSDOStreamer<LLSDNotationFormatter>(cache_ver) << std::endl; S32 count = categories.size(); @@ -2828,12 +2834,24 @@ bool LLInventoryModel::saveToFile(const std::string& filename, fileXML << LLSDOStreamer<LLSDNotationFormatter>(cat->exportLLSD()) << std::endl; cat_count++; } + + if (fileXML.fail()) + { + LL_WARNS(LOG_INV) << "Failed to write a folder to file. Unable to save inventory to: " << filename << LL_ENDL; + return false; + } } S32 it_count = items.size(); for (i = 0; i < it_count; ++i) { fileXML << LLSDOStreamer<LLSDNotationFormatter>(items[i]->asLLSD()) << std::endl; + + if (fileXML.fail()) + { + LL_WARNS(LOG_INV) << "Failed to write an item to file. Unable to save inventory to: " << filename << LL_ENDL; + return false; + } } fileXML.close(); |