浏览代码

Prevent Access Violation when FNetClients not assigned

willowrose 9 年之前
父节点
当前提交
69766b1ebf
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Units/PascalCoin/UNetProtocol.pas

+ 5 - 0
Units/PascalCoin/UNetProtocol.pas

@@ -1223,6 +1223,11 @@ var i : Integer;
 begin
 begin
   inherited;
   inherited;
   if (Operation=opRemove) then begin
   if (Operation=opRemove) then begin
+    if not Assigned(FNetClients) then // this happens occassionally
+    begin
+      TLog.NewLog(ltdebug,ClassName,'NetServer opRemove notification when NetClients=nil');
+      exit;
+    end;
     i := FNetClients.IndexOf(AComponent);
     i := FNetClients.IndexOf(AComponent);
     if (i>=0) then begin
     if (i>=0) then begin
       FNetClients.Delete(i);
       FNetClients.Delete(i);