Added fallback for token without size

This commit is contained in:
Mitchell McCaffrey
2021-01-03 16:46:22 +11:00
parent 852d5bce81
commit 037e4a4ab4
2 changed files with 2 additions and 2 deletions

View File

@@ -192,7 +192,7 @@ function MapToken({
tokenWidth > 0 &&
tokenHeight > 0
) {
const maxImageSize = Math.max(token.width, token.height);
const maxImageSize = token ? Math.max(token.width, token.height) : 512; // Default to 512px
const maxTokenSize = Math.max(tokenWidth, tokenHeight);
// Constrain image buffer to original image size
const maxRatio = maxImageSize / maxTokenSize;