Skip to content

Commit 88e7d1b

Browse files
Merge pull request #237 from jackkudo/bug/crashWhileGettingAllocatedUserChannels
Fixed crash when it tried to remove the first element in case its array is empty
2 parents 5e1311f + c2d6e6c commit 88e7d1b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

RMQClient/RMQMultipleChannelAllocator.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ - (void)releaseChannelNumber:(NSNumber *)channelNumber {
105105

106106
- (NSArray *)allocatedUserChannels {
107107
NSMutableArray *userChannels = [self.channels.allValues mutableCopy];
108-
[userChannels removeObjectAtIndex:0];
108+
if ([userChannels count] > 0) {
109+
[userChannels removeObjectAtIndex:0];
110+
}
109111
return [userChannels sortedArrayUsingComparator:^NSComparisonResult(id<RMQChannel> ch1, id<RMQChannel> ch2) {
110112
return ch1.channelNumber.integerValue > ch2.channelNumber.integerValue;
111113
}];

0 commit comments

Comments
 (0)