From e20af7828a30a6bb9ecb71022bfabed90c64d79c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 4 Nov 2020 11:31:15 +0800 Subject: [PATCH] Additional size check to avoid stuck empty string cache files, caused by exception handling --- ryzom/client/src/string_manager_client.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ryzom/client/src/string_manager_client.cpp b/ryzom/client/src/string_manager_client.cpp index d7be1f224..b868b8104 100644 --- a/ryzom/client/src/string_manager_client.cpp +++ b/ryzom/client/src/string_manager_client.cpp @@ -127,14 +127,17 @@ namespace STRING_MANAGER nlinfo("SM : Try to open the string cache : %s", _CacheFilename.c_str()); - if (CFile::fileExists(_CacheFilename)) + if (CFile::fileExists(_CacheFilename) && CFile::getFileSize(_CacheFilename)) { // there is a cache file, check date reset it if needed { NLMISC::CIFile file(_CacheFilename); file.setVersionException(false, false); file.serialVersion(currentVersion); - file.serial(_Timestamp); + if (file.getPos() + sizeof(_Timestamp) > file.getFileSize()) + _Timestamp = ~timestamp; + else + file.serial(_Timestamp); } if (_Timestamp != timestamp)