Skip to content

Commit

Permalink
fixed NPE in metrics when getting distro
Browse files Browse the repository at this point in the history
fixes #67
  • Loading branch information
mastercake10 committed Jun 15, 2020
1 parent fae2ef8 commit fc471ae
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Plugin/src/main/java/de/Linus122/TimeIsMoney/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,22 @@ public boolean accept(File dir, String filename) {
fileList = Arrays.copyOf(fileList, fileList.length + 1);
fileList[fileList.length - 1] = fileVersion;
}
//prints first version-related file
for (File f : fileList) {
try {
BufferedReader br = new BufferedReader(new FileReader(f));
String strLine = null;
while ((strLine = br.readLine()) != null) {
return strLine;

if(fileList != null) {
//prints first version-related file
for (File f : fileList) {
try {
BufferedReader br = new BufferedReader(new FileReader(f));
String strLine = null;
while ((strLine = br.readLine()) != null) {
return strLine;
}
br.close();
} catch (Exception ignored) {
}
br.close();
} catch (Exception ignored) {
}
}

return "unknown";
}
}
Expand Down

0 comments on commit fc471ae

Please sign in to comment.