Avoid nullref when shutting down
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 30 Apr 2010 13:01:59 +0000 (13:01 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 30 Apr 2010 13:01:59 +0000 (13:01 -0000)
svn path=/trunk/mcs/; revision=156519

mcs/class/System/System.Net/EndPointListener.cs

index 5d55a7540a2b1a95c2b2f6cfab87fcf32d325f24..a3e5b4a57368ddd8a616055e614e91ec133f87f6 100644 (file)
@@ -83,12 +83,14 @@ namespace System.Net {
                        EndPointListener epl = (EndPointListener) ares.AsyncState;
                        Socket accepted = null;
                        try {
-                               accepted = epl.sock.EndAccept (ares);
+                               if (epl.sock != null)
+                                       accepted = epl.sock.EndAccept (ares);
                        } catch {
                                // Anything to do here?
                        } finally {
                                try {
-                                       epl.sock.BeginAccept (OnAccept, epl);
+                                       if (epl.sock != null)
+                                               epl.sock.BeginAccept (OnAccept, epl);
                                } catch {
                                        if (accepted != null) {
                                                try {