fix possible AV in patchPlatform paths

This commit is contained in:
Basile Burg 2014-11-18 13:47:53 +01:00
parent 43c646aebb
commit a02a269a7b
1 changed files with 4 additions and 2 deletions

View File

@ -474,6 +474,8 @@ function patchPlateformExt(const aFilename: string): string;
var var
ext, newext: string; ext, newext: string;
begin begin
if aFilename = '' then exit(aFilename);
//
ext := extractFileExt(aFilename); ext := extractFileExt(aFilename);
newext := ''; newext := '';
result := aFilename[1..length(aFilename)-length(ext)]; result := aFilename[1..length(aFilename)-length(ext)];
@ -754,13 +756,13 @@ begin
// temp fix: messages are cut if the TAsyncProcess version is used on simple TProcess. // temp fix: messages are cut if the TAsyncProcess version is used on simple TProcess.
if aProcess is TAsyncProcess then begin if aProcess is TAsyncProcess then begin
while aProcess.Output.NumBytesAvailable <> 0 do begin while aProcess.Output.NumBytesAvailable <> 0 do begin
str.Size := sum + buffSz; str.SetSize(sum + buffSz);
cnt := aProcess.Output.Read((str.Memory + sum)^, buffSz); cnt := aProcess.Output.Read((str.Memory + sum)^, buffSz);
sum += cnt; sum += cnt;
end; end;
end else begin end else begin
repeat repeat
str.Size := sum + buffSz; str.SetSize(sum + buffSz);
cnt := aProcess.Output.Read((str.Memory + sum)^, buffSz); cnt := aProcess.Output.Read((str.Memory + sum)^, buffSz);
sum += cnt; sum += cnt;
until until