Skip to content

Commit

Permalink
Don't continue if SetCurrentDir fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnlaan committed Oct 5, 2024
1 parent c51f26b commit 1d270af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Projects/Src/Compression.SevenZipDecoder.pas
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ function SevenZipDecode(const FileName, DestDir: String;
const FullPaths: Boolean): Integer;
begin
var SaveCurDir := GetCurrentDir;
SetCurrentDir(DestDir);
if SetCurrentDir(DestDir) then
Exit(-1);
try
LogBuffer := '';
Result := IS_7zDec(PChar(FileName), FullPaths);
Expand Down

2 comments on commit 1d270af

@LordFreddy073
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I'm not a programmer, but from what I've seen, don't you think there should be a "not" after the "if"?
Thank you for your hard work in enhancing the stability of this program.

@martijnlaan
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, yeah, thank you! I removed the 'not' to test it and apparently forgot to put it back, doh.

Please sign in to comment.