File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -77,15 +77,21 @@ - (instancetype)init:(NSString *)path
7777
7878- (NSData *)read : (long )offset
7979 size : (long )size {
80+
8081 NSData *data = nil ;
81- [_lock lock ];
82- if (_data != nil ) {
83- data = [_data subdataWithRange: NSMakeRange (offset, (unsigned int )size)];
84- } else {
85- [_file seekToFileOffset: offset];
86- data = [_file readDataOfLength: size];
82+ @try {
83+ [_lock lock ];
84+ if (_data != nil ) {
85+ data = [_data subdataWithRange: NSMakeRange (offset, (unsigned int )size)];
86+ } else {
87+ [_file seekToFileOffset: offset];
88+ data = [_file readDataOfLength: size];
89+ }
90+ } @catch (NSException *exception) {
91+ NSLog (@" read file failed reason: %@ \n %@ " , exception.reason , exception.callStackSymbols );
92+ } @finally {
93+ [_lock unlock ];
8794 }
88- [_lock unlock ];
8995 return data;
9096}
9197
You can’t perform that action at this time.
0 commit comments