Skip to content

Commit c0ab8e6

Browse files
committed
Fixes NPE when checking filenames -- checkFile method would return true (meaning 'valid') for a null filename.
1 parent 5c38118 commit c0ab8e6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/EnrichmentMapParameters.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -831,14 +831,14 @@ public static boolean checkFile(String filename) {
831831
// Check to see if the files exist and are readable.
832832
// If the file is unreadable change the color of the font to red
833833
// otherwise the font should be black.
834-
if (filename != null) {
835-
File tempfile = new File(filename);
834+
if (filename != null && !filename.trim().isEmpty()) {
835+
File file = new File(filename.trim());
836836

837-
if (!tempfile.canRead())
838-
return false;
837+
if (file.exists() && file.canRead())
838+
return true;
839839
}
840840

841-
return true;
841+
return false;
842842
}
843843

844844
/**

0 commit comments

Comments
 (0)