2005-03-22 Peter Bartok <pbartok@novell.com>
authorPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Sun, 22 May 2005 19:17:13 +0000 (19:17 -0000)
committerPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Sun, 22 May 2005 19:17:13 +0000 (19:17 -0000)
* Graphics.cs: Fixed bug #74762, DrawString was crashing on s.Length
  if s was null.

svn path=/trunk/mcs/; revision=44894

mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/Graphics.cs

index b7a31d3a6cdd760947e37d96fdf90d579ed0b6c2..a7363abc692a24ffe4474203dc23cf2dad88cb5e 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-22  Peter Bartok  <pbartok@novell.com>
+
+       * Graphics.cs: Fixed bug #74762, DrawString was crashing on s.Length
+         if s was null.
+
 2005-05-20 Kornél Pál <kornelpal@hotmail.com>
 
        * Image.cs: Uses MemoryStream wrapping on all platforms if needed
index 0db3fa6b1d09d1e1e5c8686897bf7686c6fd0c19..1fea1c83e7e1894e6badf1ef75b1f755eb3ac0fb 100755 (executable)
@@ -788,6 +788,11 @@ namespace System.Drawing
 
                public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
                {                       
+
+                       if (s == null) {
+                               return;
+                       }
+
                        Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);
                        GDIPlus.CheckStatus (status);
                }
@@ -795,6 +800,11 @@ namespace System.Drawing
                public void DrawString (string s, Font font, Brush brush, PointF point)
                {
                        RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
+
+                       if (s == null) {
+                               return;
+                       }
+
                        Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, IntPtr.Zero, brush.nativeObject);
                        GDIPlus.CheckStatus (status);
                }
@@ -802,12 +812,21 @@ namespace System.Drawing
                public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
                {
                        RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
+
+                       if (s == null) {
+                               return;
+                       }
+
                        Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, format.NativeObject, brush.nativeObject);
                        GDIPlus.CheckStatus (status);
                }
                
                public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
                {
+                       if (s == null) {
+                               return;
+                       }
+
                        Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format.NativeObject, brush.nativeObject);
                        GDIPlus.CheckStatus (status);
                }
@@ -816,6 +835,10 @@ namespace System.Drawing
                {
                        RectangleF rc = new RectangleF (x, y, 0, 0);
                        
+                       if (s == null) {
+                               return;
+                       }
+
                        Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, 
                                ref rc, IntPtr.Zero, brush.nativeObject);
                        GDIPlus.CheckStatus (status);
@@ -825,6 +848,10 @@ namespace System.Drawing
                {
                        RectangleF rc = new RectangleF (x, y, 0, 0);
 
+                       if (s == null) {
+                               return;
+                       }
+
                        Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject,
                                ref rc, format.NativeObject, brush.nativeObject);
                        GDIPlus.CheckStatus (status);