[Modify] Throw an exception if read-only

This commit is contained in:
sta 2019-04-21 17:47:05 +09:00
parent d8fd321962
commit 449e38c239

View File

@ -603,11 +603,19 @@ namespace WebSocketSharp.Net
/// <param name="cookie">
/// A <see cref="Cookie"/> to add.
/// </param>
/// <exception cref="InvalidOperationException">
/// The collection is read-only.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="cookie"/> is <see langword="null"/>.
/// </exception>
public void Add (Cookie cookie)
{
if (_readOnly) {
var msg = "The collection is read-only.";
throw new InvalidOperationException (msg);
}
if (cookie == null)
throw new ArgumentNullException ("cookie");