diff --git a/ide/compiler.pp b/ide/compiler.pp index 1129fadf2c..c15b78933a 100644 --- a/ide/compiler.pp +++ b/ide/compiler.pp @@ -168,10 +168,13 @@ begin TheProcess.Execute; end; finally - TheProcess.WaitOnExit; - if not (TheProcess.ExitStatus in [0,1]) then begin - WriteError(Format(listCompilerInternalError,[TheProcess.ExitStatus])); - Result:=mrCancel; + if TheProcess.Running then + begin + TheProcess.WaitOnExit; + if not (TheProcess.ExitStatus in [0,1]) then begin + WriteError(Format(listCompilerInternalError,[TheProcess.ExitStatus])); + Result:=mrCancel; + end; end; end; except