wmitime: Allow -display option with no argument

Previously, if a user ran wmitime with the -display option and no argument,
a segmentation fault would occur. Print a warning instead.

Patch from Debian [1] to fix bug #716466 [2].

[1] http://sources.debian.net/src/wmitime/0.3%2B20120605-1/debian/patches/allow_display_with_no_args.patch/
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=716466
This commit is contained in:
Doug Torrance 2014-12-20 01:57:02 -06:00 committed by Carlos R. Mafra
parent cd2840a93c
commit 7bc4cffcc7

View file

@ -385,7 +385,11 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
for (i=1; argv[i]; i++) { for (i=1; argv[i]; i++) {
if (!strcmp(argv[i], "-display")) { if (!strcmp(argv[i], "-display")) {
display_name = argv[i+1]; display_name = argv[i+1];
i++; if (!display_name)
printf("Please provide an argument for "
"-display.\n");
else
i++;
} }
if (!strcmp(argv[i], "-geometry")) { if (!strcmp(argv[i], "-geometry")) {
geometry = argv[i+1]; geometry = argv[i+1];