diff options
author | Oz Linden <oz@lindenlab.com> | 2015-04-02 21:43:34 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2015-04-02 21:43:34 -0400 |
commit | 66bc5107863e8226e91818cd9d3c075d0514dbe5 (patch) | |
tree | eff63c1bff7fa3b3d74bee754099d556c0237aae /indra/newview/llappviewer.cpp | |
parent | 4aafdfd1c6ee76484b83a4e91a73af357aba0de7 (diff) |
detect xml errors in parsing xml files and remove those files
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rwxr-xr-x | indra/newview/llappviewer.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4bf719ec31..dd6b2802cd 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4653,7 +4653,12 @@ void LLAppViewer::loadNameCache() llifstream name_cache_stream(filename); if(name_cache_stream.is_open()) { - LLAvatarNameCache::importFile(name_cache_stream); + if ( ! LLAvatarNameCache::importFile(name_cache_stream)) + { + LL_WARNS("AppInit") << "removing invalid '" << filename << "'" << LL_ENDL; + name_cache_stream.close(); + LLFile::remove(filename); + } } if (!gCacheName) return; @@ -4668,7 +4673,7 @@ void LLAppViewer::loadNameCache() } void LLAppViewer::saveNameCache() - { +{ // display names cache std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); @@ -4676,16 +4681,18 @@ void LLAppViewer::saveNameCache() if(name_cache_stream.is_open()) { LLAvatarNameCache::exportFile(name_cache_stream); -} - - if (!gCacheName) return; - - std::string name_cache; - name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); - llofstream cache_file(name_cache); - if(cache_file.is_open()) - { - gCacheName->exportFile(cache_file); + } + + // real names cache + if (gCacheName) + { + std::string name_cache; + name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); + llofstream cache_file(name_cache); + if(cache_file.is_open()) + { + gCacheName->exportFile(cache_file); + } } } |