Skip to content

Commit

Permalink
NPE in the CabalBuilder fix #82
Browse files Browse the repository at this point in the history
  • Loading branch information
atsky committed May 14, 2015
1 parent 4f3f6aa commit 126a3e6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jps-plugin/src/org/jetbrains/jps/cabal/CabalBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleType;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -202,7 +201,11 @@ public void remove() {

private File getCabalFile(JpsModule module) {
String pathname = getContentRootPath(module);
for (File file : new File(pathname).listFiles()) {
File[] files = new File(pathname).listFiles();
if (files == null) {
return null;
}
for (File file : files) {
if (file.getName().endsWith(".cabal")) {
return file;
}
Expand All @@ -219,7 +222,7 @@ private String getContentRootPath(JpsModule module) {

@Override
public List<String> getCompilableFileExtensions() {
return Arrays.asList("hs");
return Collections.singletonList("hs");
}


Expand Down

0 comments on commit 126a3e6

Please sign in to comment.