浏览代码

Add missing exception handler.

Martijn Laan 3 月之前
父节点
当前提交
caf4a32756
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      Projects/Src/Compression.SevenZipDLLDecoder.pas

+ 8 - 2
Projects/Src/Compression.SevenZipDLLDecoder.pas

@@ -1013,7 +1013,8 @@ begin
     SevenZipError(SetupMessages[msgArchiveIsCorrupted], 'Cannot get number of items');
 
   if numItems = 1 then begin
-    { Get inner archive stream if it exists - See OpenArchive.cpp CArchiveLink::Open }
+    { Get inner archive stream if it exists - See OpenArchive.cpp CArchiveLink::Open
+      Give up trying to get or open it on any error }
     var MainSubFile: Cardinal;
     var SubSeqStream: ISequentialInStream;
     if not GetProperty(Result, $FFFF, kpidMainSubfile, MainSubFile) or
@@ -1032,7 +1033,12 @@ begin
     if MainSubFilePath = '' then
       MainSubFilePath := PathChangeExt(ArchiveFilename, '');
 
-    const SubClsid = GetHandler(MainSubFilePath, '');
+    var SubClsid: TGUID;
+    try
+      SubClsid := GetHandler(MainSubFilePath, '');
+    except
+      Exit;
+    end;
     var SubResult: IInArchive;
     if CreateSevenZipObject(SubClsid, IInArchive, SubResult) <> S_OK then
       Exit;