use StrToIntDef to return a default value of 0 incase pgrep returns an invalid Integer

This commit is contained in:
Pradeep Gowda 2015-05-27 23:18:30 -04:00
parent 42aa1e67eb
commit a0ff81dc4a
1 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, StrUtils, Classes, SysUtils,
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
Windows, JwaTlHelp32, Windows, JwaTlHelp32,
{$ENDIF} {$ENDIF}
@ -939,7 +939,7 @@ begin
lst := TStringList.Create; lst := TStringList.Create;
try try
lst.LoadFromStream(proc.Output); lst.LoadFromStream(proc.Output);
Result := StrToInt(Trim(lst.Text)); Result := StrToIntDef(Trim(lst.Text), 0);
finally finally
lst.Free; lst.Free;
end; end;