mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-17 13:09:25 +02:00
* Handle case where there is no handler
This commit is contained in:
parent
5b46c44b7d
commit
9780607d05
@ -1588,7 +1588,7 @@ begin
|
|||||||
SetSocketBlockingMode(Handle, bmBlocking, @FDS);
|
SetSocketBlockingMode(Handle, bmBlocking, @FDS);
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
If Not IsError then
|
If (Not IsError) and Assigned(Handler) then
|
||||||
begin
|
begin
|
||||||
IsError:=Not FHandler.Connect;
|
IsError:=Not FHandler.Connect;
|
||||||
if IsError then
|
if IsError then
|
||||||
@ -1599,7 +1599,10 @@ begin
|
|||||||
Raise ESocketError.Create(seConnectTimeOut, [Format('%s:%d',[FHost, FPort])])
|
Raise ESocketError.Create(seConnectTimeOut, [Format('%s:%d',[FHost, FPort])])
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
aErrMsg:=FHandler.GetLastErrorDescription;
|
if Assigned(FHandler) then
|
||||||
|
aErrMsg:=FHandler.GetLastErrorDescription
|
||||||
|
else
|
||||||
|
aErrMsg:='Error connecting';
|
||||||
Raise ESocketError.Create(seConnectFailed, [Format('%s:%d',[FHost, FPort]),aErrMsg]);
|
Raise ESocketError.Create(seConnectFailed, [Format('%s:%d',[FHost, FPort]),aErrMsg]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user