Add check for if argc is 0.
authorAnders Carlsson <andersca@gnome.org>
Tue, 5 Oct 2004 20:04:18 +0000 (20:04 +0000)
committerAnders Carlsson <andersca@src.gnome.org>
Tue, 5 Oct 2004 20:04:18 +0000 (20:04 +0000)
2004-10-05  Anders Carlsson  <andersca@gnome.org>

* glib/goption.c: (g_option_context_parse):
Add check for if argc is 0.

* tests/option-test.c: (empty_test3), (main):
Add test case.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/goption.c
tests/option-test.c

index 60bcde1..19801fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-10-05  Anders Carlsson  <andersca@gnome.org>
+
+       * glib/goption.c: (g_option_context_parse):
+       Add check for if argc is 0.
+       
+       * tests/option-test.c: (empty_test3), (main):
+       Add test case.
+       
 2004-10-05  Matthias Clasen  <mclasen@redhat.com>
 
        * NEWS: Update
index 60bcde1..19801fa 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-05  Anders Carlsson  <andersca@gnome.org>
+
+       * glib/goption.c: (g_option_context_parse):
+       Add check for if argc is 0.
+       
+       * tests/option-test.c: (empty_test3), (main):
+       Add test case.
+       
 2004-10-05  Matthias Clasen  <mclasen@redhat.com>
 
        * NEWS: Update
index 60bcde1..19801fa 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-05  Anders Carlsson  <andersca@gnome.org>
+
+       * glib/goption.c: (g_option_context_parse):
+       Add check for if argc is 0.
+       
+       * tests/option-test.c: (empty_test3), (main):
+       Add test case.
+       
 2004-10-05  Matthias Clasen  <mclasen@redhat.com>
 
        * NEWS: Update
index 60bcde1..19801fa 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-05  Anders Carlsson  <andersca@gnome.org>
+
+       * glib/goption.c: (g_option_context_parse):
+       Add check for if argc is 0.
+       
+       * tests/option-test.c: (empty_test3), (main):
+       Add test case.
+       
 2004-10-05  Matthias Clasen  <mclasen@redhat.com>
 
        * NEWS: Update
index 60bcde1..19801fa 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-05  Anders Carlsson  <andersca@gnome.org>
+
+       * glib/goption.c: (g_option_context_parse):
+       Add check for if argc is 0.
+       
+       * tests/option-test.c: (empty_test3), (main):
+       Add test case.
+       
 2004-10-05  Matthias Clasen  <mclasen@redhat.com>
 
        * NEWS: Update
index 1868505..8001bad 100644 (file)
@@ -825,7 +825,7 @@ g_option_context_parse (GOptionContext   *context,
   GList *list;
 
   /* Set program name */
-  if (argc && argv)
+  if (argc && argv && *argc)
     {
       gchar *prgname;
       
index d08b223..daf7591 100644 (file)
@@ -508,6 +508,22 @@ empty_test2 (void)
   g_option_context_free (context);
 }
 
+void
+empty_test3 (void)
+{
+  GOptionContext *context;
+  gint argc;
+  gchar **argv;
+
+  argc = 0;
+  argv = NULL;
+
+  context = g_option_context_new (NULL);
+  g_option_context_parse (context, &argc, &argv, NULL);
+  
+  g_option_context_free (context);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -537,6 +553,7 @@ main (int argc, char **argv)
   /* Test parsing empty args */
   empty_test1 ();
   empty_test2 ();
-  
+  empty_test3 ();
+
   return 0;
 }