From 8947c86db2bbbe43cc78c58a0cea05addfde8042 Mon Sep 17 00:00:00 2001 From: Ruri Date: Sun, 15 Dec 2024 18:26:01 +0100 Subject: [PATCH] Fixed small mistake that made tests fail --- RuriLib/Helpers/Blocks/DescriptorsRepository.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/RuriLib/Helpers/Blocks/DescriptorsRepository.cs b/RuriLib/Helpers/Blocks/DescriptorsRepository.cs index 6e2d842f8..6197d8ef9 100644 --- a/RuriLib/Helpers/Blocks/DescriptorsRepository.cs +++ b/RuriLib/Helpers/Blocks/DescriptorsRepository.cs @@ -197,8 +197,12 @@ private static BlockParameter BuildBlockParameter(ParameterInfo info) /// public static VariableType? ToVariableType(Type type) { - _variableTypes.TryGetValue(type, out var value); - return value ?? throw new InvalidCastException( + if (_variableTypes.TryGetValue(type, out var value)) + { + return value; + } + + throw new InvalidCastException( $"The type {type} could not be casted to VariableType"); }