mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
gapplicationcommandline: Handle the possibility empty args in an example
While it’s not usual, it is possible for applications to be called with an empty `argv` by a process (ab)using `execve()`. Modify the `GApplication` code example to handle that possibility, so that anyone copying the example isn’t introducing a bug into their program immediately. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
fc6d0ba3a8
commit
0d743e7ffb
@ -119,6 +119,12 @@
|
|||||||
*
|
*
|
||||||
* argv = *arguments;
|
* argv = *arguments;
|
||||||
*
|
*
|
||||||
|
* if (argv[0] == NULL)
|
||||||
|
* {
|
||||||
|
* *exit_status = 0;
|
||||||
|
* return FALSE;
|
||||||
|
* }
|
||||||
|
*
|
||||||
* i = 1;
|
* i = 1;
|
||||||
* while (argv[i])
|
* while (argv[i])
|
||||||
* {
|
* {
|
||||||
|
Loading…
Reference in New Issue
Block a user