From 94aba0105efa92fcb3c8ba1a125e17af72a1894d Mon Sep 17 00:00:00 2001
From: Jeffrey Walton <noloader@gmail.com>
Date: Mon, 8 Aug 2022 02:07:57 -0400
Subject: [PATCH] Fix segfault with no-arg invocation of cryptest program (GH
#1141) This break was introduced at 6f3fd26ab849ac71
---
test.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test.cpp b/test.cpp
index 73ab43929..842fde8e4 100644
--- a/test.cpp
+++ b/test.cpp
@@ -426,7 +426,7 @@ int scoped_main(int argc, char *argv[])
else if (command == "h")
{
FileSource usage(DataDir("TestData/usage.dat").c_str(), true, new FileSink(std::cout));
- return argv[1][0] == 'h' ? 0 : 1;
+ return argc >= 2 && argv[1][0] == 'h' ? 0 : 1;
}
else if (command == "V")
{