ooper-shlab / SourceView-Swift

A translation of Apple's sample code for Mac "SourceView: Using NSOutlineView with NSTreeController" into Swift
Other
27 stars 7 forks source link

Crash on adding Bookmark #4

Open znafets opened 6 years ago

znafets commented 6 years ago

R: build, run

  1. select Yahoo!
  2. select "Add Bookmark" in button area
  3. give a name and uri
  4. click OK -> crash

backtrace:

fatal error: unexpectedly found nil while unwrapping an Optional value
2017-09-15 08:53:01.243204+0200 SourceView[41928:4469771] fatal error: unexpectedly found nil while unwrapping an Optional value
Current stack trace:
0    libswiftCore.dylib                 0x000000010039c130 swift_reportError + 129
1    libswiftCore.dylib                 0x00000001003b8b50 _swift_stdlib_reportFatalError + 60
2    libswiftCore.dylib                 0x00000001001a9250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
3    libswiftCore.dylib                 0x0000000100323e90 partial apply for (_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #2) + 109
4    libswiftCore.dylib                 0x00000001001a9250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
5    libswiftCore.dylib                 0x00000001002d69a0 specialized _fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96
6    SourceView                         0x0000000100031fd0 IconViewController.(gatherContents(Any) -> ()).(closure #1) + 866
7    SourceView                         0x0000000100033430 thunk + 32
8    SourceView                         0x0000000100034cb0 partial apply for thunk + 81
9    libswiftObjectiveC.dylib           0x000000010096b5a0 autoreleasepool<A> (invoking : () throws -> A) throws -> A + 56
10   SourceView                         0x0000000100031ed0 IconViewController.gatherContents(Any) -> () + 206
11   SourceView                         0x0000000100031a40 IconViewController.didSetBaseNode(BaseNode?) -> () + 184
12   SourceView                         0x0000000100031510 IconViewController.baseNode.didset + 46
13   SourceView                         0x0000000100031470 IconViewController.baseNode.setter + 122
14   SourceView                         0x0000000100019640 MyOutlineViewController.viewControllerForSelection([NSTreeNode]?) -> NSViewController? + 2516
15   SourceView                         0x0000000100008f50 MySplitViewController.observeValue(forKeyPath : String?, of : Any?, change : [NSKeyValueChangeKey : Any]?, context : UnsafeMutableRawPointer?) -> () + 910
16   SourceView                         0x0000000100009a90 @objc MySplitViewController.observeValue(forKeyPath : String?, of : Any?, change : [NSKeyValueChangeKey : Any]?, context : UnsafeMutableRawPointer?) -> () + 621
17   Foundation                         0x00007fffcd6a21ff NSKeyValueNotifyObserver + 350
18   Foundation                         0x00007fffcd719456 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 990
19   AppKit                             0x00007fffc993bf4b -[NSController _notifyObserversForKeyPath:change:] + 194
20   AppKit                             0x00007fffc9a4da32 -[NSTreeController _didChangeValuesForArrangedKeys:objectKeys:indexPathKeys:] + 192
21   AppKit                             0x00007fffc9a4d277 -[NSTreeController _selectObjectsAtIndexPathsNoCopy:avoidsEmptySelection:sendObserverNotifications:] + 507
22   AppKit                             0x00007fffc9a5818f -[NSTreeController _selectObjectsAtIndexPaths:avoidsEmptySelection:sendObserverNotifications:] + 68
23   SourceView                         0x0000000100012430 MyOutlineViewController.selectParentFromSelection() -> () + 1047
24   SourceView                         0x00000001000135d0 MyOutlineViewController.performAddChild(TreeAdditionObj) -> () + 744
25   SourceView                         0x0000000100014350 MyOutlineViewController.addChild(URL?, withName : String?, selectParent : Bool) -> () + 279
26   SourceView                         0x0000000100017310 MyOutlineViewController.(addBookmark(Notification) -> ()).(closure #1) + 1242
27   SourceView                         0x00000001000065f0 thunk + 47
28   AppKit                             0x00007fffc99d8a50 -[NSWindow _endWindowBlockingModalSession:returnCode:] + 248
29   SourceView                         0x000000010000c980 ChildEditViewController.done(AnyObject) -> () + 2285
30   SourceView                         0x000000010000d330 @objc ChildEditViewController.done(AnyObject) -> () + 54
31   libsystem_trace.dylib              0x00007fffe1620372 _os_activity_initiate_impl + 53
32   AppKit                             0x00007fffc9ee5559 -[NSApplication(NSResponder) sendAction:to:from:] + 456
33   AppKit                             0x00007fffc99c9c6e -[NSControl sendAction:to:] + 86
34   AppKit                             0x00007fffc99c9b64 __26-[NSCell _sendActionFrom:]_block_invoke + 136
35   libsystem_trace.dylib              0x00007fffe1620372 _os_activity_initiate_impl + 53
36   AppKit                             0x00007fffc99c9ac4 -[NSCell _sendActionFrom:] + 128
37   AppKit                             0x00007fffc9a0c4d7 -[NSButtonCell _sendActionFrom:] + 98
38   libsystem_trace.dylib              0x00007fffe1620372 _os_activity_initiate_impl + 53
39   AppKit                             0x00007fffc99c7a75 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2481
40   AppKit                             0x00007fffc9a0bf54 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 798
41   AppKit                             0x00007fffc99c6a9b -[NSControl mouseDown:] + 832
42   AppKit                             0x00007fffca05f98a -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 6341
43   AppKit                             0x00007fffca05d2d6 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 1942
44   AppKit                             0x00007fffca05cced -[NSWindow(NSEventRouting) sendEvent:] + 541
45   AppKit                             0x00007fffc9ee1208 -[NSApplication(NSEvent) sendEvent:] + 1145
46   AppKit                             0x00007fffc975c03d -[NSApplication run] + 1002
47   AppKit                             0x00007fffc9726939 NSApplicationMain + 1237
48   SourceView                         0x000000010002eeb0 main + 13
49   libdyld.dylib                      0x00007fffe13ee234 start + 1
ooper-shlab commented 6 years ago

I believe I have fixed this issue, please check it.