Browse Source

Fixed crash when evaluator received command execution context but wanted the parameter of the command execution context

CPKreuz 1 year ago
parent
commit
aa119a58ac
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/PixiEditor/Models/Commands/CommandController.cs

+ 5 - 0
src/PixiEditor/Models/Commands/CommandController.cs

@@ -422,8 +422,13 @@ internal class CommandController
     {
         object CastParameter(object input, Type target)
         {
+            var commandExecutionType = typeof(CommandExecutionContext);
+            if (input is CommandExecutionContext context && !target.IsAssignableTo(commandExecutionType))
+                input = context.Parameter;
+
             if (target == typeof(object) || target == input?.GetType())
                 return input;
+            
             return Convert.ChangeType(input, target);
         }