From 33d512e7b8b08bcbcfdc264566add6a32d127a2e Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 25 Jun 2021 21:29:03 +1000 Subject: [PATCH] Update upgrade.js --- src/upgrade.js | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/upgrade.js b/src/upgrade.js index a3fb0be..a90dd5a 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -514,17 +514,18 @@ export const versions = { resolution, }); } - - assets.push({ - id: uuid(), - owner: map.owner, - file: map.thumbnail.file, - width: map.thumbnail.width, - height: map.thumbnail.height, - mime: "", - prevId: map.id, - prevType: "mapThumbnail", - }); + if (map.thumbnail) { + assets.push({ + id: uuid(), + owner: map.owner, + file: map.thumbnail.file, + width: map.thumbnail.width, + height: map.thumbnail.height, + mime: "", + prevId: map.id, + prevType: "mapThumbnail", + }); + } } maps = null; await tx.table("assets").bulkAdd(assets); @@ -557,16 +558,18 @@ export const versions = { prevId: token.id, prevType: "token", }); - assets.push({ - id: uuid(), - owner: token.owner, - file: token.thumbnail.file, - width: token.thumbnail.width, - height: token.thumbnail.height, - mime: "", - prevId: token.id, - prevType: "tokenThumbnail", - }); + if (token.thumbnail) { + assets.push({ + id: uuid(), + owner: token.owner, + file: token.thumbnail.file, + width: token.thumbnail.width, + height: token.thumbnail.height, + mime: "", + prevId: token.id, + prevType: "tokenThumbnail", + }); + } } tokens = null; await tx.table("assets").bulkAdd(assets);