Fix crash in update checker if package.json's repository value is set to a repository without releases

master
Dragory 2019-12-05 20:24:39 +02:00
parent dab1154154
commit d625e527d6
1 changed files with 3 additions and 1 deletions

View File

@ -60,7 +60,9 @@ async function refreshVersions() {
res.on('data', chunk => data += chunk);
res.on('end', async () => {
const parsed = JSON.parse(data);
let latestVersion = parsed[0].name;
if (! Array.isArray(parsed) || parsed.length === 0) return;
const latestVersion = parsed[0].name;
await knex('updates').update({
available_version: latestVersion,
last_checked: moment.utc().format('YYYY-MM-DD HH:mm:ss')