- sm_cocoaHash.insert(wxCocoaNSViewHash::value_type(cocoaNSView,this));
- [[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(notificationFrameChanged:) name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
- [cocoaNSView setPostsFrameChangedNotifications: YES];
+ if(cocoaNSView)
+ {
+ sm_cocoaHash.insert(wxCocoaNSViewHash::value_type(cocoaNSView,this));
+ [[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(notificationFrameChanged:) name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
+ [cocoaNSView setPostsFrameChangedNotifications: YES];
+ }