« get me outta code hell

data: CacheableObject: check default update value more gracefully - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-31 23:30:37 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 23:30:37 -0300
commit84954c24f11660d658e6bdd6ed20b15cd0fbaeb9 (patch)
treee8606d59d209a5ecd5ea8d1f774e92fd28441d12
parent304984c43f86e80c85474c14ad5aa4fa9f82a61e (diff)
data: CacheableObject: check default update value more gracefully
Fixes a test failure introduced in cebd7f4a, and more generally,
crashes to do with flags: {update: true} but no update: {...}
configuration.
-rw-r--r--src/data/cacheable-object.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/data/cacheable-object.js b/src/data/cacheable-object.js
index 4a89b774..71dc5bde 100644
--- a/src/data/cacheable-object.js
+++ b/src/data/cacheable-object.js
@@ -132,7 +132,11 @@ export default class CacheableObject {
         return;
       }
 
-      if ('default' in update) {
+      if (
+        typeof update === 'object' &&
+        update !== null &&
+        'default' in update
+      ) {
         this[property] = update?.default;
       } else {
         this[property] = null;