From e28d8b30c06ad884d6efe0cb91e62998b3600c26 Mon Sep 17 00:00:00 2001 From: "Michael A. Hawker" Date: Sat, 6 Nov 2021 17:17:15 -0700 Subject: [PATCH] Add lower-bound check to index for sample execution --- samples/ComputeSharp.SwapChain/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/ComputeSharp.SwapChain/Program.cs b/samples/ComputeSharp.SwapChain/Program.cs index d5743d30..4e0a091d 100644 --- a/samples/ComputeSharp.SwapChain/Program.cs +++ b/samples/ComputeSharp.SwapChain/Program.cs @@ -56,14 +56,14 @@ class Program } while (!int.TryParse(Console.ReadLine(), out index)); - if (index < Samples.Length) + if (index >= 0 && index < Samples.Length) { Console.WriteLine(); Console.WriteLine($"Starting {Samples[index].GetType().GenericTypeArguments[0].Name}..."); Win32ApplicationRunner.Run(Samples[index]); } - } while (index < Samples.Length); + } while (index >= 0 && index < Samples.Length); } ///