[Mono-dev] Bug in ShrinkArray in Xutil.cs?
Bob Frankston
mono-bob at Bobf.frankston.com
Fri Jun 20 16:13:39 EDT 2008
In the code below shouldn't
prev += o
check for null:
if (prev == null)
prev = o;
else
prev += o;
What is worrisome about this bug is that it seems so basic that it shows up
in even the simplest use of XML.LINQ -- does that mean that no one is using
it?
***********
public static IEnumerable ShrinkArray (params object [] content)
{
if (content == null || content.Length == 0)
yield break;
string prev = null;
foreach (object o in content) {
if (o is XNode) {
if (prev != null) {
yield return prev;
prev = null;
}
yield return o;
} else {
prev += o;
}
}
if (prev != null)
yield return prev;
}
}
--
View this message in context: http://www.nabble.com/Bug-in-ShrinkArray-in-Xutil.cs--tp18036646p18036646.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list