From c6e25839faba4fb2e7a685ccdc607b55f99f3850 Mon Sep 17 00:00:00 2001 From: Jen Lampton Date: Tue, 10 Dec 2024 15:15:24 -0800 Subject: [PATCH] Issue #9: Harden against accidental fatals. --- content_lock.module | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/content_lock.module b/content_lock.module index d018740..1c07158 100644 --- a/content_lock.module +++ b/content_lock.module @@ -1149,11 +1149,15 @@ function content_lock_content_lock_node_lockable($node) { return $lockable[$format][$node->nid]; } - $types = array_filter($config->get('content_lock_allowed_node_types')); - // Let other modules modify our blacklist. - backdrop_alter('content_lock_node_type_blacklist', $types, $node); - $formats = array_filter($config->get('content_lock_allowed_formats')); - $lockable[$format][$node->nid] = FALSE; + $saved_types = $config->get('content_lock_allowed_node_types'); + if (!empty($saved_types)) { + $types = array_filter($saved_types); + // Let other modules modify our blacklist. + backdrop_alter('content_lock_node_type_blacklist', $types, $node); + $formats = array_filter($config->get('content_lock_allowed_formats')); + $lockable[$format][$node->nid] = FALSE; + } + // Determine if the node is of a lockable content type or text format. if ((empty($types) || in_array($node->type, $types)) && (empty($formats) || in_array($format, $formats))