« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/things/thing.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index c1f969b2..798a057a 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -866,8 +866,9 @@ export default class Thing extends CacheableObject {
     // within the provided thingData dependency. This will early exit if the
     // data dependency is null, or, if earlyExitIfNotFound is set to true,
     // if the find function doesn't match anything for the reference.
-    // Otherwise, the data object (or null, if not found) is provided on
-    // the output dependency.
+    // Otherwise, the data object is provided on the output dependency;
+    // or null, if the reference doesn't match anything or itself was null
+    // to begin with.
     withResolvedReference({
       ref: refDependency,
       data: dataDependency,
@@ -883,6 +884,8 @@ export default class Thing extends CacheableObject {
           dependencies: [refDependency, dataDependency],
 
           compute({[refDependency]: ref, [dataDependency]: data}, continuation) {
+            if (!ref) return continuation({[outputDependency]: null});
+
             if (data === null) return null;
 
             const match = findFunction(ref, data, {mode: 'quiet'});