<div dir="ltr">FileSystem has a bunch of methods that unconditionally use `m_fs`. There's no reason `IsLocal` is special in that regard. If this crashes(which is what the radar is about) it's because the FileSystem is not properly initialized and we should figure out why instead. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 25, 2022 at 6:41 PM Med Ismail Bennani via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
Author: Med Ismail Bennani<br>
Date: 2022-02-25T18:33:31-08:00<br>
New Revision: 2dc6e906b09deb092c15a726c06d0ecbeec1eb18<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18.diff</a><br>
<br>
LOG: [lldb/Host] Fix crash in FileSystem::IsLocal<br>
<br>
This checks `m_fs` before dereferencing it to access its`isLocal` method.<br>
<br>
rdar://67410058<br>
<br>
Signed-off-by: Med Ismail Bennani <<a href="mailto:medismail.bennani@gmail.com" target="_blank">medismail.bennani@gmail.com</a>><br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
    lldb/source/Host/common/FileSystem.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp<br>
index 1e4a24abe3017..26a98fa0a4ec4 100644<br>
--- a/lldb/source/Host/common/FileSystem.cpp<br>
+++ b/lldb/source/Host/common/FileSystem.cpp<br>
@@ -192,7 +192,8 @@ bool FileSystem::IsDirectory(const FileSpec &file_spec) const {<br>
<br>
 bool FileSystem::IsLocal(const Twine &path) const {<br>
   bool b = false;<br>
-  m_fs->isLocal(path, b);<br>
+  if (m_fs)<br>
+    m_fs->isLocal(path, b);<br>
   return b;<br>
 }<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>