NSArray+ex.m 610 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // NSArray+ex.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/6/5.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "NSArray+ex.h"
  9. @implementation NSArray (ex)
  10. - (id)h_safeObjectAtIndex:(NSUInteger)index{
  11. if(self.count ==0) {
  12. // NSLog(@"--- mutableArray have no objects ---");
  13. return (nil);
  14. }
  15. if(index >MAX(self.count -1,0)) {
  16. // NSLog(@"--- index:%li out of mutableArray range ---", (long)index);
  17. return (nil);
  18. }
  19. return ([self objectAtIndex:index]);
  20. }
  21. @end