[Mono-devel-list] [PATCH] Fix null reference exceptions in System.Data.DataView

Marc Haisenko haisenko at webport.de
Wed Jul 6 06:57:41 EDT 2005


Hi folks,
I just noticed that a bug in DataView.cs is still/again present in the current 
revision (r46988, svn://svn.myrealbox.com/source/trunk/mcs/)

The problem is that a variable, rowCache, is often set to null but no null 
checks are done. That way a fresh instance of DataView throws a 
NullReferenceException e.g. when reading the Count property as it simply does 
"return rowCache.Length;".

The fix is to never set the variable to null but to an empty array. The 
attached patch implements this fix (only three lines need that fix). I 
already sent a patch to fix the very same bug on 11.11.2004, it seems like it 
never got included...

C'ya,
	Marc

-- 
Marc Haisenko
Systemspezialist
Webport IT-Services GmbH
mailto: haisenko at webport.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DataView.cs.patch
Type: text/x-diff
Size: 832 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050706/2de61ad8/attachment.bin 


More information about the Mono-devel-list mailing list