From 0f8d3cc9c44877625bb889e1d05c44aaccafb51a Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sun, 3 Dec 2023 19:31:33 +0100 Subject: [PATCH] Add argument check for matLerp --- osu.Framework/Utils/PathApproximator.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Framework/Utils/PathApproximator.cs b/osu.Framework/Utils/PathApproximator.cs index dcfb9eb38f..1228f5c75d 100644 --- a/osu.Framework/Utils/PathApproximator.cs +++ b/osu.Framework/Utils/PathApproximator.cs @@ -474,9 +474,12 @@ private static void adamUpdate(float[,] parameters, float[,] m, float[,] v, int } } - // mat1 can not be the same array as result, or it will not work correctly private static unsafe void matLerp(float[,] mat1, float[,] mat2, float t, float[,] result) { + // mat1 can not be the same array as result, or it will not work correctly + if (ReferenceEquals(mat1, result)) + throw new ArgumentException($"{nameof(mat1)} can not be the same array as {nameof(result)}."); + fixed (float* mat1P = mat1, mat2P = mat2, resultP = result) { var span1 = new Span(mat1P, mat1.Length);