summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 360dc3b)
raw | patch | inline | side by side (parent: 360dc3b)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 19 Sep 2023 11:43:11 +0000 (14:43 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 19 Sep 2023 11:43:11 +0000 (14:43 +0300) |
src/shared/WADEDITOR_dfwad.pas | patch | blob | history |
index 97097bb2f7c47ac3fa2c406ee6dfb8368810f9d6..2bbc03a3a031397b198d21cd1793574c6ca9b612 100644 (file)
begin
nrec := LEtoN(s.ReadWord());
section := '';
+ sec := nil;
for i := 0 to nrec - 1 do
begin
s.ReadBuffer(name1251[0], 16);
begin
if sec = nil then
sec := InsertSectionRAW('');
+ if res = nil then
+ raise Exception.Create('Failed to create root section');
res := InsertFileInfoS(sec, name, offset, csize, -1, nil);
if res = nil then
raise Exception.Create('Failed to register resource [' + section + '][' + name + ']');
FreeWAD();
Result := False;
try
+ s := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
try
- s := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
- try
- ReadFromStream(s);
- FStream := s;
- FLastError := DFWAD_NOERROR;
- Result := True;
- except
- s.Free();
- raise;
- end;
+ ReadFromStream(s);
+ FStream := s;
+ FLastError := DFWAD_NOERROR;
+ Result := True;
except
- on e: Exception do
- begin
- if gWADEditorLogLevel >= DFWAD_LOG_INFO then
- e_WriteLog('DFWAD: Failed to read DFWAD from file ' + FileName + ', reason: ' + e.Message, MSG_WARNING);
- Clear();
- end;
+ s.Free();
+ raise;
end;
except
on e: EFOpenError do
else
FLastError := DFWAD_ERROR_WADNOTFOUND;
end;
+ on e: Exception do
+ begin
+ if gWADEditorLogLevel >= DFWAD_LOG_INFO then
+ e_WriteLog('DFWAD: Failed to read DFWAD from file ' + FileName + ', reason: ' + e.Message, MSG_WARNING);
+ Clear();
+ end;
end;
end;