Fix gst_init() so that it doesn't fail when passed two NULLs as parameters.

Original commit message from CVS:
Fix gst_init() so that it doesn't fail when passed two NULLs as parameters.
Was dereferencing the argv pointer to get progname: now defaults to
"gstprog".
This commit is contained in:
Richard Boulton 2001-03-09 12:31:07 +00:00
parent 1f3f906886
commit d19fde7e35

View file

@ -63,8 +63,6 @@ gst_init (int *argc, char **argv[])
if (!g_thread_supported ()) g_thread_init (NULL); if (!g_thread_supported ()) g_thread_init (NULL);
_gst_progname = g_strdup(*argv[0]);
gtk_init (argc,argv); gtk_init (argc,argv);
if (!gst_init_check (argc,argv)) { if (!gst_init_check (argc,argv)) {
@ -123,9 +121,13 @@ gst_init_check (int *argc,
gboolean ret = TRUE; gboolean ret = TRUE;
gboolean showhelp = FALSE; gboolean showhelp = FALSE;
_gst_progname = NULL;
if (argc && argv) { if (argc && argv) {
gint i, j, k; gint i, j, k;
_gst_progname = g_strdup(*argv[0]);
for (i=1; i< *argc; i++) { for (i=1; i< *argc; i++) {
if (!strncmp ("--gst-info-mask=", (*argv)[i], 16)) { if (!strncmp ("--gst-info-mask=", (*argv)[i], 16)) {
guint32 val; guint32 val;
@ -184,6 +186,10 @@ gst_init_check (int *argc,
} }
} }
if (_gst_progname == NULL) {
_gst_progname = g_strdup("gstprog");
}
/* check for ENV variables */ /* check for ENV variables */
{ {