Skip to content

Commit

Permalink
Handle builds that have no commit msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Nats-ji committed Jan 5, 2022
1 parent eb21156 commit c33eb68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/get_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ async function get_build(aVersion)
async function get_commit(aVersion, aBuild)
{
let json = await get_json(`https://papermc.io/api/v2/projects/paper/versions/${aVersion}/builds/${aBuild}/`)
return json.changes[0].commit;
return json.changes.length > 0 ? json.changes[0].commit : get_commit(aVersion, Number(aBuild) - 1);
}

async function get_commit_msg(aVersion, aBuild)
{
let json = await get_json(`https://papermc.io/api/v2/projects/paper/versions/${aVersion}/builds/${aBuild}/`)
return json.changes[0].message;
return json.changes.length > 0 ? json.changes[0].message : "No Changes";
}

async function get_released_version(aGhRepo)
Expand Down

0 comments on commit c33eb68

Please sign in to comment.