From d1339120eafcd697f2931c7622d8180c3b3925cc Mon Sep 17 00:00:00 2001 From: Marek Novosad Date: Tue, 15 Aug 2023 17:32:08 +0200 Subject: [PATCH] Index out of array, flags to int return invalid "index" in Enum --- Src/Noesis/Core/Src/Core/RenderDevice.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Src/Noesis/Core/Src/Core/RenderDevice.cs b/Src/Noesis/Core/Src/Core/RenderDevice.cs index c5f620e..93ef245 100644 --- a/Src/Noesis/Core/Src/Core/RenderDevice.cs +++ b/Src/Noesis/Core/Src/Core/RenderDevice.cs @@ -306,7 +306,9 @@ public static Shader.Vertex.Format.Attr.Type.Enum TypeForAttr(Shader.Vertex.Form 1, 3, 1, 1, 0, 4, 2, 2 }; - return (Shader.Vertex.Format.Attr.Type.Enum)map[(int)attr]; + int index = Array.IndexOf(Enum.GetValues(typeof(Shader.Vertex.Format.Attr.Enum)), attr); + + return (Shader.Vertex.Format.Attr.Type.Enum)map[index]; } ///