Merge pull request #820 from brendanzagaeski/master
[mono.git] / mcs / class / System / System.Net / WebUtility.cs
index 322a0c8b1d02bd35cfebdbd157e285f51c805c7c..7aec94896c6c8692be01bfd1cf018191a8f4b31c 100644 (file)
@@ -1,8 +1,10 @@
 //\r
 // System.Net.WebUtility\r
 //\r
-// Author: Mike Kestner  <mkestner@novell.com>\r
+// Authors: Mike Kestner  <mkestner@novell.com>\r
+//          Marek Safar (marek.safar@gmail.com)\r
 //\r
+// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)\r
 //\r
 // Permission is hereby granted, free of charge, to any person obtaining\r
 // a copy of this software and associated documentation files (the\r
@@ -37,11 +39,17 @@ namespace System.Net
                \r
                public static string HtmlDecode (string value)\r
                {\r
+                       if (string.IsNullOrEmpty (value))\r
+                               return value;\r
+\r
                        return HttpUtility.HtmlDecode (value);\r
                }\r
                \r
                public static void HtmlDecode (string value, TextWriter output)\r
                {\r
+                       if (output == null)\r
+                               throw new ArgumentNullException ("output");\r
+\r
                        output.Write (HtmlDecode (value));\r
                }\r
                \r
@@ -52,6 +60,9 @@ namespace System.Net
                \r
                public static void HtmlEncode (string value, TextWriter output)\r
                {\r
+                       if (output == null)\r
+                               throw new ArgumentNullException ("output");\r
+\r
                        output.Write (HtmlEncode (value));\r
                }\r
                \r