     {
     	doingWholesaleChanges = false;
     	
-    	if (selectedIndex >= 0 && selectedIndex < dataProvider.length)
+    	if (selectedIndex >= 0 && dataProvider && selectedIndex < dataProvider.length)
     	   itemSelected(dataProvider.getItemAt(selectedIndex), true);
     	else
     	   selectedIndex = -1;
     	   
-    	dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler);
+    	if (dataProvider)
+    	    dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler);
     }
     
     protected function collectionChangeHandler(event:Event):void

            
            if (requiresSelection &&
                    selectedIndex == NO_SELECTION &&
                    dataProvider.length > 0)
            {
            	// Set the proposed selected index here to make sure

    private function commitSelectedIndex():Boolean
    {
        // Step 1: make sure the proposed selected index is in range.
        var maxIndex:int = dataProvider ? dataProvider.length - 1 : -1;
        var oldIndex:int = _selectedIndex;
        
        if (_proposedSelectedIndex < NO_SELECTION)
            _proposedSelectedIndex = NO_SELECTION;
        if (_proposedSelectedIndex > maxIndex)
            _proposedSelectedIndex = maxIndex;
        if (requiresSelection && _proposedSelectedIndex == NO_SELECTION && 
            dataProvider && dataProvider.length > 0)
            return false;
        
        // Step 2: dispatch the "selectionChanging" event. If preventDefault() is called
