ClassyKit / Classy

Expressive, flexible, and powerful stylesheets for UIView and friends.
http://classykit.github.io/Classy/
MIT License
740 stars 76 forks source link

Crashed if no new line at the end of "stylesheet.cas" #83

Closed itvexesme closed 10 years ago

itvexesme commented 10 years ago

I catch crash, if stylesheet.cas don't have "\n" and the end of file. It seems like bug.

file "stylesheet.cas"
----------
@import "menu.cas"
----------
2014-10-04 23:22:18.774 xxx [26485:3618636] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x0248bdf6 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x02115a97 objc_exception_throw + 44
    2   CoreFoundation                      0x023431e1 -[__NSArrayM insertObject:atIndex:] + 881
    3   CoreFoundation                      0x02342e41 -[__NSArrayM addObject:] + 65
    4   xxx                   0x001d82bc -[CASParser parseString:error:] + 1740
    5   xxx                   0x001d71ad +[CASParser parserFromFilePath:variables:error:] + 1165
    6   xxx                   0x001e5e01 -[CASStyler setFilePath:error:] + 337
    7   xxx                   0x001e5c30 -[CASStyler setFilePath:] + 112
    8   xxx                   0x001e5316 -[CASStyler styleItem:] + 326
    9   xxx                   0x001f702f -[UIView(CASAdditions) cas_updateStyling] + 95
    10  xxx                   0x001f6a80 -[UIView(CASAdditions) cas_didMoveToWindow] + 48
    11  UIKit                               0x00fe41c9 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1703
    12  UIKit                               0x00fe3e4f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
    13  UIKit                               0x00fdb137 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 154
    14  UIKit                               0x00fdb095 -[UIView(Hierarchy) _postMovedFromSuperview:] + 458
    15  UIKit                               0x00fe6b9e -[UIView(Internal) _addSubview:positioned:relativeTo:] + 2067
    16  UIKit                               0x00fd948e -[UIView(Hierarchy) addSubview:] + 56
    17  UIKit                               0x0149a969 -[UIStatusBarWindow setStatusBar:] + 339
    18  UIKit                               0x00f609c0 -[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:] + 354
    19  UIKit                               0x00f5cfa6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1184
    20  UIKit                               0x00f75d30 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
    21  UIKit                               0x00f5bd7f -[UIApplication workspaceDidEndTransaction:] + 155
    22  FrontBoardServices                  0x05f159de __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
    23  FrontBoardServices                  0x05f1546f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
    24  FrontBoardServices                  0x05f27425 __31-[FBSSerialQueue performAsync:]_block_invoke + 26
    25  CoreFoundation                      0x023af7a0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    26  CoreFoundation                      0x023a50b3 __CFRunLoopDoBlocks + 195
    27  CoreFoundation                      0x023a4f0b __CFRunLoopRun + 2715
    28  CoreFoundation                      0x023a41ab CFRunLoopRunSpecific + 443
    29  CoreFoundation                      0x023a3fdb CFRunLoopRunInMode + 123
    30  UIKit                               0x00f5b744 -[UIApplication _run] + 571
    31  UIKit                               0x00f5ee16 UIApplicationMain + 1526
    32  xxx                   0x0009a0fd main + 141
    33  libdyld.dylib                       0x0298eac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException