Index: src/OFLHAArchive.m ================================================================== --- src/OFLHAArchive.m +++ src/OFLHAArchive.m @@ -35,10 +35,11 @@ #import "OFInvalidArgumentException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" +#import "OFUnsupportedVersionException.h" #import "OFWriteFailedException.h" enum { modeRead, modeWrite, @@ -317,12 +318,15 @@ else if ([compressionMethod isEqual: @"-lh7-"]) _decompressedStream = [[OFLHADecompressingStream alloc] of_initWithStream: stream distanceBits: 5 dictionaryBits: 17]; - else + else if ([compressionMethod isEqual: @"-lh0-"]) _decompressedStream = [stream retain]; + else + @throw [OFUnsupportedVersionException + exceptionWithVersion: compressionMethod]; _entry = [entry copy]; _toRead = entry.uncompressedSize; } @catch (id e) { [self release]; @@ -332,11 +336,11 @@ return self; } - (void)dealloc { - if (_stream != nil || _decompressedStream != nil) + if (_stream != nil && _decompressedStream != nil) [self close]; [_entry release]; if (_archive->_lastReturnedStream == self)