Changeset 20877

Show
Ignore:
Timestamp:
02.11.2009 13:40:10 (10 years ago)
Author:
ak19
Message:

Fixed minor bug: clicking on trash icon when nothing's selected caused a null pointer exveption.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/gui/GatherPane.java

    r18593 r20877  
    150150        // Find the active tree (you've made selections in). 
    151151        DragTree tree = (DragTree) group.getActive(); 
    152         // Fudge things a bit 
    153         group.setSource(tree); 
    154         // Determine the selection. 
    155         TreePath paths[] = tree.getSelectionPaths(); 
    156         if(paths != null) { 
    157             FileNode[] source_nodes = new FileNode[paths.length]; 
    158             for(int i = 0; i < paths.length; i++) { 
    159             source_nodes[i] = (FileNode)(paths[i].getLastPathComponent()); 
     152        if (tree != null) { // if something has indeed been selected 
     153            // Fudge things a bit 
     154            group.setSource(tree); 
     155            // Determine the selection. 
     156            TreePath paths[] = tree.getSelectionPaths(); 
     157            if(paths != null) { 
     158            FileNode[] source_nodes = new FileNode[paths.length]; 
     159            for(int i = 0; i < paths.length; i++) { 
     160                source_nodes[i] = (FileNode)(paths[i].getLastPathComponent()); 
     161            } 
     162            Gatherer.f_man.action(tree, source_nodes, Gatherer.recycle_bin, null); 
    160163            } 
    161             Gatherer.f_man.action(tree, source_nodes, Gatherer.recycle_bin, null); 
    162164        } 
    163165        }