From 747fc0557e1e274bc196b799185666b0125fb7ef Mon Sep 17 00:00:00 2001 From: sta Date: Fri, 25 Nov 2016 16:38:51 +0900 Subject: [PATCH] [Modify] Add a check To determine if the file exists. --- websocket-sharp/WebSocket.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 3bdfd53e..67fd3df0 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2835,6 +2835,9 @@ namespace WebSocketSharp if (file == null) throw new ArgumentNullException ("file"); + if (!file.Exists) + throw new ArgumentException ("The file does not exist.", "file"); + FileStream stream; if (!file.TryOpenRead (out stream)) throw new ArgumentException ("Cannot be opened to read.", "file");