Crash after opening an NSDocument-based document

Originator:chad515
Number:rdar://10638416 Date Originated:1/3/2012
Status:Duplicate Resolved:No
Product:Mac OS X Product Version:10.7.2
Classification:Crash Reproducible:Always
 
Summary:
After opening a document represented by a NSDocument subclass which does not have its window outlet connected in its xib file, the app will crash.

Steps to Reproduce:
1) Create a 64-bit document-based application in Xcode. Use any common filetype for the document filetype (e.g. pdf).
2) Open the created xib file and disconnect the connection between File's Owner and the window
3) Launch the application
4) Drag a file of the type you selected (e.g. pdf) from Finder to the Dock icon for the application
5) Watch the window appear
6) Within 5 seconds, the app will crash

Expected Results:
The app to not crash. If the outlet does need to be connected, then a useful error message.

Actual Results:
The app crashes due to an uncaught exception with the following stack trace:
2012-01-02 16:04:03.405 Pear Note[5933:507] An uncaught exception was raised
2012-01-02 16:04:03.406 Pear Note[5933:507] *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
2012-01-02 16:04:03.409 Pear Note[5933:507] (
	0   CoreFoundation                      0x00007fff94eb1286 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff8dd6bd5e objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff94e58108 -[__NSArrayM insertObject:atIndex:] + 296
	3   AppKit                              0x00007fff970e475d __-[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:]_block_invoke_2 + 1089
	4   AppKit                              0x00007fff971e9ca7 __-[NSDocumentController _openDocumentsWithContentsOfURLs:presentErrors:completionHandler:]_block_invoke_2 + 50
	5   Foundation                          0x00007fff8f835b95 -[NSBlockOperation main] + 116
	6   Foundation                          0x00007fff8f7fc788 -[__NSOperationInternal start] + 705
	7   Foundation                          0x00007fff8f80f9e6 ____NSOQSchedule_block_invoke_2 + 124
	8   libdispatch.dylib                   0x00007fff961f78ba _dispatch_call_block_and_release + 18
	9   libdispatch.dylib                   0x00007fff961f972a _dispatch_main_queue_callback_4CF + 308
	10  CoreFoundation                      0x00007fff94e464dc __CFRunLoopRun + 1724
	11  CoreFoundation                      0x00007fff94e45ae6 CFRunLoopRunSpecific + 230
	12  HIToolbox                           0x00007fff918793d3 RunCurrentEventLoopInMode + 277
	13  HIToolbox                           0x00007fff9188063d ReceiveNextEventCommon + 355
	14  HIToolbox                           0x00007fff918804ca BlockUntilNextEventMatchingListInMode + 62
	15  AppKit                              0x00007fff96e273f1 _DPSNextEvent + 659
	16  AppKit                              0x00007fff96e26cf5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
	17  AppKit                              0x00007fff96e2362d -[NSApplication run] + 470
	18  AppKit                              0x00007fff970a280c NSApplicationMain + 867
	19  Pear Note                           0x000000010001a172 main + 34
	20  Pear Note                           0x00000001000021b4 start + 52
)

Regression:
This did not happen on 10.5 or 10.6.

Notes:

Comments

Closed as a dup

This bug was just closed as a dup of rdar://9896209


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!