add return null if latest release not found

This commit is contained in:
kamontat
2017-02-20 10:20:53 +07:00
parent 1cffea892b
commit 5554332b5b

View File

@@ -300,7 +300,11 @@ public class GHRepository extends GHObject {
}
public GHRelease getLatestRelease() throws IOException {
return root.retrieve().to(getApiTailUrl("releases/latest"), GHRelease.class).wrap(this);
try {
return root.retrieve().to(getApiTailUrl("releases/latest"), GHRelease.class).wrap(this);
} catch (FileNotFoundException e) {
return null; // no latest release
}
}
public PagedIterable<GHRelease> listReleases() throws IOException {