don't crash with missing argument
authorMatthias Braun <matze@braunis.de>
Thu, 7 Sep 2006 11:33:35 +0000 (11:33 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 7 Sep 2006 11:33:35 +0000 (11:33 +0000)
ir/be/test/langshootout/n-body.c

index c1aa2e4..7081537 100644 (file)
@@ -129,9 +129,12 @@ struct planet bodies[NBODIES] = {
 
 int main(int argc, char ** argv)
 {
-  int n = atoi(argv[1]);
+  int n = 1000000;
   int i;
 
+  if(argc > 1)
+         n = atoi(argv[1]);
+
   offset_momentum(NBODIES, bodies);
   printf ("%.9f\n", energy(NBODIES, bodies));
   for (i = 1; i <= n; i++)