Fixed NPE when contract dir missing; fixes gh-1830

This commit is contained in:
Marcin Grzejszczak
2022-11-22 11:56:04 +01:00
parent fe5a6a1ac3
commit 9e536c8273

View File

@@ -249,8 +249,8 @@ class ContractsCopyTask extends DefaultTask {
}
return;
}
if (failOnNoContracts.get() && (!file.exists() || file.listFiles().length == 0)) {
String path = file.getAbsolutePath();
if (failOnNoContracts.get() && (file == null || !file.exists() || file.listFiles().length == 0)) {
String path = file != null file.getAbsolutePath() : "";
throw new GradleException("Contracts could not be found: [" + path
+ "]\nPlease make sure that the contracts were defined, or set the [failOnNoContracts] flag to [false]");
}
@@ -541,4 +541,4 @@ class ContractsCopyTask extends DefaultTask {
return str;
}
}
}