From b98f327aad9ecf8a720f271aa97ac2aecf596b25 Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Mon, 17 May 2021 12:55:49 +0100 Subject: [PATCH] fix: add null check --- src/includes/class-convert.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/includes/class-convert.php b/src/includes/class-convert.php index 3393500..684851a 100644 --- a/src/includes/class-convert.php +++ b/src/includes/class-convert.php @@ -55,7 +55,9 @@ class Convert { * @since 1.0-beta * @todo Replace with built-in type casting. */ - public static function to_bool( string $value ): bool { + public static function to_bool( string|null $value ): bool { + if (!$value) return false; + // Convert string to lower-case to make it easier. $value = strtolower( $value ); // Check if string seems to contain a "true" value.