Skip to content

Commit 6e0063c

Browse files
committed
More graceful handling of MS-CAB sets
1 parent 78373dd commit 6e0063c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

BinaryObjectScanner/FileType/MicrosoftCAB.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ public bool Extract(Stream? stream, string file, string outDir, bool includeDebu
3333
#if NET20 || NET35 || !WINX86
3434
// TODO: Remove once Serialization is updated
3535

36-
// Get a wrapper for the set
37-
var current = OpenSet(file);
36+
// Get a wrapper for the set, if possible
37+
SabreTools.Serialization.Wrappers.MicrosoftCabinet? current;
38+
if (File.Exists(file))
39+
current = OpenSet(file);
40+
else
41+
current = SabreTools.Serialization.Wrappers.MicrosoftCabinet.Create(stream);
42+
43+
// Validate the header exists
3844
if (current?.Model?.Header == null)
3945
return false;
4046

0 commit comments

Comments
 (0)