File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,18 @@ public byte[] Compress(byte[] bytes)
3939 }
4040
4141 result = memoryStream . ToArray ( ) ;
42+
43+ if ( result . Length >= 8 )
44+ {
45+ result [ 4 ] = 25 ;
46+ result [ 5 ] = 134 ;
47+ result [ 6 ] = 2 ;
48+ result [ 7 ] = 32 ;
49+ }
50+ }
51+ catch
52+ {
53+
4254 }
4355 finally
4456 {
@@ -49,14 +61,6 @@ public byte[] Compress(byte[] bytes)
4961 }
5062 }
5163
52- if ( result != null && result . Length >= 8 )
53- {
54- result [ 4 ] = 25 ;
55- result [ 5 ] = 134 ;
56- result [ 6 ] = 2 ;
57- result [ 7 ] = 32 ;
58- }
59-
6064 return result ;
6165 }
6266
@@ -69,7 +73,7 @@ public byte[] Decompress(byte[] bytes)
6973 {
7074 if ( bytes == null || bytes . Length <= 0 )
7175 {
72- return bytes ;
76+ return null ;
7377 }
7478
7579 MemoryStream decompressedStream = null ;
@@ -91,6 +95,10 @@ public byte[] Decompress(byte[] bytes)
9195
9296 return decompressedStream . ToArray ( ) ;
9397 }
98+ catch
99+ {
100+ return null ;
101+ }
94102 finally
95103 {
96104 if ( decompressedStream != null )
You can’t perform that action at this time.
0 commit comments