I hope to help other person to fix the bug of a project

I notice all most more than 1/2 of total bugs are 

-[\_\_NSCFArray objectAtIndex:]: index (i) beyond bounds

```
NSRangeException(SIGABRT)

-[__NSCFArray objectAtIndex:]: index (3) beyond bounds (3)
0   CoreFoundation  0x00000001822682d8  ___exceptionPreprocess
1   libobjc.A.dylib     0x0000000193a940e4  objc_exception_throw + 56
2   CoreFoundation  0x0000000182268218  -[NSException initWithCoder:]
3   CoreFoundation  0x0000000182165a9c  -[__NSCFArray objectAtIndex:]
4   SoYoungMobile40     0x00000001000bae98  0x0000000100030000 + 568976
5   SoYoungMobile40     0x00000001001609c0  0x0000000100030000 + 1247680
6   UIKit   0x0000000186d0c77c  -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:]
7   UIKit   0x0000000186d0a754  -[UICollectionView _updateVisibleCellsNow:]
8   UIKit   0x0000000186d06004  -[UICollectionView layoutSubviews]
9   UIKit   0x0000000186ca5760  -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
10  QuartzCore  0x00000001865ede1c  -[CALayer layoutSublayers]
11  QuartzCore  0x00000001865e8884  CA::Layer::layout_if_needed(CA::Transaction*)
12  QuartzCore  0x00000001865e8728  CA::Layer::layout_and_display_if_needed(CA::Transaction*)
13  QuartzCore  0x00000001865e7ebc  CA::Context::commit_transaction(CA::Transaction*)
14  QuartzCore  0x00000001865e7c3c  CA::Transaction::commit()
15  QuartzCore  0x000000018663e1f4  CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
16  IOKit   0x0000000183419470  IODispatchCalloutFromCFMessage + 376
17  CoreFoundation  0x000000018220adc4  ___CFMachPortPerform
18  CoreFoundation  0x000000018221fa54  ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
19  CoreFoundation  0x000000018221f9b4  ___CFRunLoopDoSource1
20  CoreFoundation  0x000000018221d934  ___CFRunLoopRun
21  CoreFoundation  0x00000001821492d4  CFRunLoopRunSpecific + 392
22  GraphicsServices    0x000000018b95f6fc  GSEventRunModal + 156
23  UIKit   0x0000000186d0efac  UIApplicationMain + 1476
24  SoYoungMobile40     0x0000000100445590  0x0000000100030000 + 4281744
25  libdyld.dylib   0x0000000194112a08  _start

```

from the information send back from user, I can not locate where the crash exactly.

Is there a common way to avoid index beyond bounds error.

My way is put some code before objectAtIndex, but I do not know if this is OK.

Your comment welcome