« 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/util/html.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/util/html.js b/src/util/html.js
index 7bce9ae8..d1d509e2 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -1838,15 +1838,19 @@ const isAttributesAdditionSingletHelper =
     looseArrayOf(value => isAttributesAdditionSinglet(value)));
 
 export const isAttributesAdditionSinglet = (value) => {
-  if (typeof value === 'object') {
+  if (typeof value === 'object' && value !== null) {
     if (Object.hasOwn(value, blessAttributes)) {
       return true;
     }
 
-    if (Array.isArray(value) && value.length === 1) {
-      if (Object.hasOwn(value[0], blessAttributes)) {
-        return true;
-      }
+    if (
+      Array.isArray(value) &&
+      value.length === 1 &&
+      typeof value[0] === 'object' &&
+      value[0] !== null &&
+      Object.hasOwn(value[0], blessAttributes)
+    ) {
+      return true;
     }
   }