issue 34 - npe reading npm without canonical

This commit is contained in:
Grahame Grieve 2019-06-11 07:26:55 +10:00
parent 74cfa3efcc
commit c3a0958c94
2 changed files with 4 additions and 1 deletions

View File

@ -271,7 +271,7 @@ import com.google.gson.JsonObject;
}
public String canonical() {
return npm.get("canonical").getAsString();
return npm.has("canonical") ? npm.get("canonical").getAsString() : null;
}
/**

View File

@ -245,6 +245,9 @@ public class PackageCacheManager {
public void recordMap(String url, String id) throws IOException {
if (url == null)
return;
if (!(new File(Utilities.path(cacheFolder, "packages.ini")).exists()))
throw new Error("File "+Utilities.path(cacheFolder, "packages.ini")+" not found #1");
IniFile ini = new IniFile(Utilities.path(cacheFolder, "packages.ini"));