fix #41, D&D broken in 2a1

This commit is contained in:
Basile Burg 2015-09-27 00:03:22 +02:00
parent 54b13358de
commit 7d0b295a76
1 changed files with 14 additions and 2 deletions

View File

@ -182,10 +182,15 @@ begin
else else
loader.Position:= 0; loader.Position:= 0;
// //
fJSON.Free; FreeAndNil(fJSON);
parser := TJSONParser.Create(loader); parser := TJSONParser.Create(loader);
try
try try
fJSON := parser.Parse as TJSONObject; fJSON := parser.Parse as TJSONObject;
except
if assigned(fJSON) then
FreeAndNil(fJSON);
end;
finally finally
parser.Free; parser.Free;
end; end;
@ -426,6 +431,8 @@ procedure TCEDubProject.updatePackageNameFromJson;
var var
value: TJSONData; value: TJSONData;
begin begin
if not assigned(fJSON) then
exit;
value := fJSON.Find('name'); value := fJSON.Find('name');
if not assigned(value) then fPackageName := '' if not assigned(value) then fPackageName := ''
else fPackageName := value.AsString; else fPackageName := value.AsString;
@ -440,6 +447,8 @@ var
begin begin
fBuildTypes.Clear; fBuildTypes.Clear;
fConfigs.Clear; fConfigs.Clear;
if not assigned(fJSON) then
exit;
// the CE interface for dub doesn't make the difference between build type // the CE interface for dub doesn't make the difference between build type
//and config, instead each possible combination type + build is generated. //and config, instead each possible combination type + build is generated.
if fJSON.Find('configurations') <> nil then if fJSON.Find('configurations') <> nil then
@ -514,6 +523,8 @@ var
pth: string; pth: string;
begin begin
fSrcs.Clear; fSrcs.Clear;
if not assigned(fJSON) then
exit;
lst := TStringList.Create; lst := TStringList.Create;
try try
// auto folders & files // auto folders & files
@ -685,6 +696,7 @@ var
end; end;
begin begin
fOutputFileName := ''; fOutputFileName := '';
if not assigned(fJSON) then exit;
item := fJSON.Find('name'); item := fJSON.Find('name');
if not assigned(item) then if not assigned(item) then
exit; exit;