[gjs/ewlsh/nova-repl: 1/2] esm: Guard debugging log which assumes importing privates are objects




commit a7951caad9097262718b542f56966e7145a8cd74
Author: Evan Welsh <contact evanwelsh com>
Date:   Wed Aug 25 18:56:05 2021 -0700

    esm: Guard debugging log which assumes importing privates are objects
    
    Fixes #429

 gjs/module.cpp | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gjs/module.cpp b/gjs/module.cpp
index 3c617135..eef5f337 100644
--- a/gjs/module.cpp
+++ b/gjs/module.cpp
@@ -628,11 +628,18 @@ bool gjs_dynamic_module_resolve(JSContext* cx,
                            JSPROP_PERMANENT))
         return false;
 
-    gjs_debug(GJS_DEBUG_IMPORTER,
-              "Async module resolve hook for module '%s' (relative to %p), "
-              "global %p",
-              gjs_debug_string(specifier).c_str(),
-              &importing_module_priv.toObject(), global.get());
+    if (importing_module_priv.isObject()) {
+        gjs_debug(GJS_DEBUG_IMPORTER,
+                  "Async module resolve hook for module '%s' (relative to %p), "
+                  "global %p",
+                  gjs_debug_string(specifier).c_str(),
+                  &importing_module_priv.toObject(), global.get());
+    } else {
+        gjs_debug(GJS_DEBUG_IMPORTER,
+                  "Async module resolve hook for module '%s' (unknown path), "
+                  "global %p",
+                  gjs_debug_string(specifier).c_str(), global.get());
+    }
 
     JS::RootedValueArray<2> args(cx);
     args[0].set(importing_module_priv);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]