FSA: Fix null-deref in getDirectory()

Haven't tested locally, but the discussion on the bug suggests a very
straightforward fix. Clusterfuzz can verify this accordingly (or not).

Bug: 1252866
Change-Id: I2bf6f51f51b0c70074230500bfa4e5af5c71cecd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3949714
Reviewed-by: Christine Smith <christinesm@chromium.org>
Commit-Queue: Christine Smith <christinesm@chromium.org>
Auto-Submit: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1058252}
diff --git a/third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.cc b/third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.cc
index e1de7f75..e77e0ef 100644
--- a/third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.cc
+++ b/third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.cc
@@ -35,7 +35,7 @@
 
 void GetDirectoryImpl(ScriptPromiseResolver* resolver, bool allow_access) {
   ExecutionContext* context = resolver->GetExecutionContext();
-  if (!resolver->GetScriptState()->ContextIsValid())
+  if (!context || !resolver->GetScriptState()->ContextIsValid())
     return;
 
   if (!allow_access) {