From c6c7e9194745d5fd2d68cb648363a072f96d7c73 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Tue, 20 Dec 2022 22:43:53 -0500
Subject: [PATCH] Fix broken cache read for mesh

---
 indra/llfilesystem/llfilesystem.cpp | 2 +-
 indra/newview/llmeshrepository.cpp  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp
index 69bfde5af03..a810cf1d36c 100644
--- a/indra/llfilesystem/llfilesystem.cpp
+++ b/indra/llfilesystem/llfilesystem.cpp
@@ -80,7 +80,7 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
 {
     if (!mFile)
     {
-        LL_WARNS() << "Attempt to write to file " << mFileID << " that is not open" << LL_ENDL;
+        LL_WARNS() << "Attempt to read from file " << mFileID << " that is not open" << LL_ENDL;
         return FALSE;
     }
 
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 00bf76019ae..a7af989851c 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1355,7 +1355,7 @@ bool LLMeshRepoThread::loadInfoFromFilesystem(const LLUUID& mesh_id, MeshHeaderI
 {
 	//check cache for mesh skin info
 	LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
-	if (file.getSize() >= info.mOffset + info.mSize)
+	if (file.open() && file.getSize() >= info.mOffset + info.mSize)
 	{
 		auto buffer = std::make_unique<U8[]>(info.mSize);
 		if (!buffer)
-- 
GitLab