From 1f129a812c62c20e0c4003beeb83007f583e01bb Mon Sep 17 00:00:00 2001 From: kolen Date: Mon, 1 Jul 2024 17:46:24 +0300 Subject: [PATCH] Handle non-StandardError in custom functions Prevent segmentation fault due to returning null pointer when non-StandardError exception is raised in custom functions. Abort with error message instead. --- lib/sassc/functions_handler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sassc/functions_handler.rb b/lib/sassc/functions_handler.rb index 8a3c3495..b76bbc1e 100644 --- a/lib/sassc/functions_handler.rb +++ b/lib/sassc/functions_handler.rb @@ -25,7 +25,7 @@ def setup(native_options, functions: Script::Functions) function_arguments = arguments_from_native_list(native_argument_list) result = functions_wrapper.send(custom_function, *function_arguments) to_native_value(result) - rescue StandardError => exception + rescue Exception => exception # This rescues any exceptions that occur either in value conversion # or during the execution of a custom function. error(exception.message)