grammatica-users
[Top][All Lists]
Advanced

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

Re: [Grammatica-users] Bug: ParseException.Details will crash when erro


From: Per Cederberg
Subject: Re: [Grammatica-users] Bug: ParseException.Details will crash when error does not provide a Details list
Date: Tue, 24 Mar 2009 22:25:27 +0100

Thanks for the bug report. I've added it to the bug tracker for the
next update to Grammatica:

https://savannah.nongnu.org/bugs/index.php?25986

Cheers,

/Per

2009/3/24 William Lahti <address@hidden>:
> If you receive a ParseException and try to inspect it's Details property, it
> may crash if the exception has a null 'details' field, as get_Details tries
> to make a copy of the 'details' field without checking if it's null.
> Here's the exception I received:
> System.ArgumentNullException: Collection cannot be null.
> Parameter name: c
>    at System.Collections.ArrayList..ctor(ICollection c)
>    at PerCederberg.Grammatica.Runtime.ParseException.get_Details()
>    ...
> Here's the offending property:
>
>        public ArrayList Details {
>             get {
>                 return new ArrayList(details);
>             }
>         }
> It's found at line 208 in
> src/csharp/PerCederberg.Grammatica.Runtime/ParseException.cs
> The fix is easy:
>        public ArrayList Details {
>             get {
>                 if (details == null)
>                        return new ArrayList (); // or just null, but an
> empty list makes more sense imho
>                 return new ArrayList(details);
>             }
>         }
> Sorry I couldn't provide a patch, but I don't have a proper diff tool on
> this Windows box and it's a really minor change (though hard to get around
> without recompiling Grammatica).
> --
> rezonant
>
> long name: William Lahti
> handle :: rezonant
> freenode :: xfury
> blog :: http://xfurious.blogspot.com/
> site :: http://komodocorp.com/~wilahti
>
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
>




reply via email to

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