gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApplication and an empty argument


From: Tom Davie
Subject: Re: NSApplication and an empty argument
Date: Mon, 5 Nov 2012 12:15:05 +0000

On 5 Nov 2012, at 12:08, Luboš Doležel <address@hidden> wrote:

> Hi,
> 
> if you pass an empty argument to a GNUstep app with a GUI, it will abort with 
> an exception (NSRangeException: Invalid index). Example:
> 
> ./hellococoa ''
> 
> This is my suggested fix:
> 
> --- NSApplication.m.orig  2012-11-04 19:00:00.934920184 +0100
> +++ NSApplication.m 2012-11-04 19:02:57.022792994 +0100
> @@ -4121,6 +4121,9 @@
>  [en nextObject]; // skip the first element, which is always empty...
>  while((file = [en nextObject]) != nil)
>    {
> +      if([file length] == 0)
> +        continue;
> +
>      unichar c = [file characterAtIndex: 0];
>      if(c != '-')
> {

Surely this is the incorrect behaviour, as it will cause off-by-one errors for 
the subsequent arguments.  Instead, it's surely correct to report the existence 
of an empty argument correctly.

Tom Davie


reply via email to

[Prev in Thread] Current Thread [Next in Thread]