FIX: Division by zero

This commit is contained in:
Alexander Koblov 2018-10-20 13:18:20 +00:00
commit ee6205482e
2 changed files with 4 additions and 4 deletions

View file

@ -550,7 +550,7 @@ begin
begin
FLastError:= libssh2_session_last_errno(FSession);
if (FLastError <> LIBSSH2_ERROR_EAGAIN) then Exit(False);
DoProgress((FileSize - TotalBytesToWrite) * 100 div FileSize);
if (FileSize > 0) then DoProgress((FileSize - TotalBytesToWrite) * 100 div FileSize);
FSock.CanRead(10);
end;
until not ((TargetHandle = nil) and (FLastError = LIBSSH2_ERROR_EAGAIN));
@ -621,7 +621,7 @@ begin
begin
FLastError:= libssh2_session_last_errno(FSession);
if (FLastError <> LIBSSH2_ERROR_EAGAIN) then Exit(False);
DoProgress((FileSize - TotalBytesToRead) * 100 div FileSize);
if (FileSize > 0) then DoProgress((FileSize - TotalBytesToRead) * 100 div FileSize);
FSock.CanRead(10);
end;
until not ((SourceHandle = nil) and (FLastError = LIBSSH2_ERROR_EAGAIN));

View file

@ -239,7 +239,7 @@ begin
begin
FLastError:= libssh2_session_last_errno(FSession);
if (FLastError <> LIBSSH2_ERROR_EAGAIN) then Exit(False);
DoProgress((FileSize - TotalBytesToWrite) * 100 div FileSize);
if (FileSize > 0) then DoProgress((FileSize - TotalBytesToWrite) * 100 div FileSize);
FSock.CanRead(10);
end;
until not ((TargetHandle = nil) and (FLastError = LIBSSH2_ERROR_EAGAIN));
@ -310,7 +310,7 @@ begin
begin
FLastError:= libssh2_session_last_errno(FSession);
if (FLastError <> LIBSSH2_ERROR_EAGAIN) then Exit(False);
DoProgress((FileSize - TotalBytesToRead) * 100 div FileSize);
if (FileSize > 0) then DoProgress((FileSize - TotalBytesToRead) * 100 div FileSize);
FSock.CanRead(10);
end;
until not ((SourceHandle = nil) and (FLastError = LIBSSH2_ERROR_EAGAIN));