commit 91c0363f5c67b70ec4396dc75a7e5d27ff737828
parent d97288c2f32338d974c7374b0a6df4326d69ea15
Author: Alexander Burger <abu@software-lab.de>
Date: Wed, 1 Aug 2012 11:59:23 +0200
Proper argv check
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -1,4 +1,4 @@
-/* 07jun12abu
+/* 01aug12abu
* (c) Software Lab. Alexander Burger
*/
@@ -1204,7 +1204,7 @@ static void init(int ac, char *av[]) {
AV = av;
heapAlloc();
initSymbols();
- if (strcmp(av[ac-2], "+") == 0)
+ if (ac >= 2 && strcmp(av[ac-2], "+") == 0)
val(Dbg) = T, av[ac-2] = NULL;
if (av[0] && *av[0] != '-' && (p = strrchr(av[0], '/')) && !(p == av[0]+1 && *av[0] == '.')) {
Home = malloc(p - av[0] + 2);