[Mono-bugs] [Bug 52890][Nor] New - GroupCollection returns null object from string indexer when groupName is not found

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 14 Jan 2004 21:33:20 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by rduerden@hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=52890

--- shadow/52890	2004-01-14 21:33:20.000000000 -0500
+++ shadow/52890.tmp.22006	2004-01-14 21:33:20.000000000 -0500
@@ -0,0 +1,34 @@
+Bug#: 52890
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: rduerden@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: GroupCollection returns null object from string indexer when groupName is not found
+
+static void Main(string[] args)
+		{
+Regex regex = new Regex( "[A-Za-z_0-9]" );
+
+Match m = regex.Match( "123456789abc" );
+
+object o = null;
+o.ToString();
+if( m.Groups["not_defined"].Length > 0 )
+    //  Mono : 'System.NullReferenceException'
+    Console.WriteLine( "found group" ); 
+else
+    Console.WriteLine( "no group found" ); // outputs 'no group found' on 
+MS .NET
+                
+		}