make dnsasync better handle cleanup of a partially constructed instance
authorplugwash <plugwash@p10link.net>
Thu, 13 Aug 2009 18:50:30 +0000 (18:50 +0000)
committerplugwash <plugwash@p10link.net>
Thu, 13 Aug 2009 18:50:30 +0000 (18:50 +0000)
git-svn-id: file:///svnroot/lcore/trunk@56 b1de8a11-f9be-4011-bde0-cc7ace90066a

dnsasync.pas

index 8c3ce3a01d4afca44a754a3f268ca826fb6452ed..a8e1aa654b6d56778f3b9c9c11c3062bc534d4d8 100755 (executable)
@@ -100,12 +100,14 @@ var
   socketno : integer;\r
 begin\r
   for socketno := 0 to numsock -1 do begin\r
-    if dnsserverids[socketno] >= 0 then begin\r
-      reportlag(dnsserverids[socketno],-1);\r
-      dnsserverids[socketno] := -1;\r
-    end;\r
-    sockets[socketno].release;\r
-    setstate_request_init('',states[socketno]);\r
+    if assigned(sockets[socketno]) then begin
+      if dnsserverids[socketno] >= 0 then begin\r
+        reportlag(dnsserverids[socketno],-1);\r
+        dnsserverids[socketno] := -1;\r
+      end;\r
+      sockets[socketno].release;\r
+      setstate_request_init('',states[socketno]);\r
+    end;
   end;\r
   inherited destroy;\r
 end;\r