fix NPEs loading invalid packages

This commit is contained in:
Grahame Grieve 2020-08-06 22:36:20 +10:00
parent f93f47ee24
commit 8b3ce7b3cc
2 changed files with 6 additions and 0 deletions

View File

@ -128,6 +128,9 @@ public abstract class BasePackageCacheManager implements IPackageCacheManager {
}
private String getPackageId(String canonical, String server) throws IOException {
if (canonical == null) {
return null;
}
PackageClient pc = myClientFactory.apply(server);
List<PackageClient.PackageInfo> res = pc.search(null, canonical, null, false);
if (res.size() == 0) {

View File

@ -544,6 +544,9 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
// ========================= Package Mgmt API =======================================================================
private String getPackageIdFromBuildList(String canonical) throws IOException {
if (canonical == null) {
return null;
}
checkBuildLoaded();
if (buildInfo != null) {
for (JsonElement n : buildInfo) {