[Lldb-commits] [lldb] 2dc6e90 - [lldb/Host] Fix crash in FileSystem::IsLocal

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 25 18:41:41 PST 2022


Author: Med Ismail Bennani
Date: 2022-02-25T18:33:31-08:00
New Revision: 2dc6e906b09deb092c15a726c06d0ecbeec1eb18

URL: https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18
DIFF: https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18.diff

LOG: [lldb/Host] Fix crash in FileSystem::IsLocal

This checks `m_fs` before dereferencing it to access its`isLocal` method.

rdar://67410058

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/source/Host/common/FileSystem.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp
index 1e4a24abe3017..26a98fa0a4ec4 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -192,7 +192,8 @@ bool FileSystem::IsDirectory(const FileSpec &file_spec) const {
 
 bool FileSystem::IsLocal(const Twine &path) const {
   bool b = false;
-  m_fs->isLocal(path, b);
+  if (m_fs)
+    m_fs->isLocal(path, b);
   return b;
 }
 


        


More information about the lldb-commits mailing list