IDE: In compiler options -> Other -> Defines, catch an exception when parsing an invalid option.

git-svn-id: trunk@43727 -
This commit is contained in:
juha 2014-01-15 00:08:49 +00:00
parent 0e189386d9
commit 9121265a10
2 changed files with 7 additions and 2 deletions

View File

@ -644,7 +644,7 @@ begin
// ToDo: figure out the length in a more clever way.
if (Length(aOptAndValue) < 3) or (aOptAndValue[1] <> '-') then
raise Exception.CreateFmt('Invalid option or value "%s".', [aOptAndValue]);
if aOptAndValue[2] in ['e', 'd', 'u', 'I', 'k', 'o'] then
if aOptAndValue[2] in ['e', 'u', 'I', 'k', 'o'] then
OptLen := 2
else
OptLen := 3;
@ -1125,7 +1125,7 @@ begin
for j := 0 to sl.Count-1 do
if AnsiStartsStr('-d', sl[j]) then
begin
if not AnsiStartsStr(CommentId, sl[j]) then
if (Length(sl[j]) > 2) and not AnsiStartsStr(CommentId, sl[j]) then
fDefines.Add(sl[j])
end
else

View File

@ -145,6 +145,7 @@ var
EditForm: TCustomDefinesForm;
begin
EditForm := TCustomDefinesForm.Create(Nil);
try
try
EditForm.OptionsReader := FOptionsReader;
EditForm.OptionsThread := FOptionsThread;
@ -158,6 +159,10 @@ begin
EditForm.ToCustomOptions(memoCustomOptions.Lines);
memoCustomOptions.Invalidate;
end;
except
on E: Exception do
ShowMessage('Error parsing custom options: '+E.Message);
end;
finally
EditForm.Free;
end;