     
     private function layoutEditorIndicator(layer:GridLayer):void
     {
-        const rowIndex:int = grid.dataGrid.editorRowIndex;
-        const columnIndex:int = grid.dataGrid.editorColumnIndex;
-        var indicatorFactory:IFactory = grid.dataGrid.editorIndicator;
+        const dataGrid:DataGrid = grid.dataGrid;
+        if (!dataGrid)
+            return;
+        
+        const rowIndex:int = dataGrid.editorRowIndex;
+        const columnIndex:int = dataGrid.editorColumnIndex;
+        var indicatorFactory:IFactory = dataGrid.editorIndicator;
         
         // If the indicatorFactory has changed for the specified non-null indicator, 
         // then free the old indicator.

import mx.events.CollectionEventKind;
import mx.events.PropertyChangeEvent;

import spark.components.Grid;
import spark.layouts.supportClasses.LayoutBase;


        
        // To avoid flashing, force all of the layers to render now
        
        if (backgroundLayer) backgroundLayer.validateNow();
        if (selectionLayer) selectionLayer.validateNow();
        if (overlayLayer) overlayLayer.validateNow();
        
        // The old visible row,column indices are no longer needed
        
