Skip to content

Commit

Permalink
DTM Editor: Catch exception in case of invalid DTM
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlijnWajer committed Jan 15, 2011
1 parent 29082f6 commit fa4d894
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Extensions/dtm_editor.sex
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,15 @@ var
begin
if InputQuery('DTM From String', 'Enter DTM string:', s) and (s <> '') then
begin
mnuNew(nil);
try
dtm := DTMFromString(Trim(s));
except
if (MessageDlg('Invalid DTM', 'Invalid string! Make sure you only enter the string (without quotes), not stuff like "DTM := DTMFromString("!', mtError, [mbOk, mbCancel] {$ifdef PS_EXTENSION}, 0{$endif}) = 1) then
mnuDTMfromString(Sender);
Exit;
end;

dtm := DTMFromString(s);
mnuNew(nil);
mdtm := GetDTM(dtm);
sdtm := MDTMToSDTM(mdtm);

Expand Down Expand Up @@ -1354,3 +1360,5 @@ begin
ThreadSafe_ShowForm;
{$endif}
end.


0 comments on commit fa4d894

Please sign in to comment.