quinntaylor / CHDataStructures

An Objective-C library of data structures, such as deque, heap, linked list, queue, stack, and tree.
Other
387 stars 78 forks source link

Requesting empty subsets causes nil arg exceptions #4

Closed mbauman closed 9 years ago

mbauman commented 10 years ago

When requesting a subsetFromObject:toObject: that starts after the last object, it tries to add a nil object to the class, causing an exception. This simple fix adds a check for anObject before starting to look for the end of the subset.


Added test cases for subsetFromObject:toObject:... that demonstrate the problem and validate other empty selections. Check to make sure anObject is still valid after finding our start position.

quinntaylor commented 9 years ago

Thanks, I pulled in this change and adjusted whitespace to match the project, see commit ddddb82deaa559854645a989120a7b92ec885b64.