From a1976a6092bb285df733dfd1ee7bb993fcc5166a Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Thu, 27 May 2021 20:58:55 +0200 Subject: [PATCH] Fix edge-case with titles --- create-card.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/create-card.js b/create-card.js index cef4efa..f1edeee 100644 --- a/create-card.js +++ b/create-card.js @@ -266,7 +266,10 @@ class CardCreator { ctx.textAlign = "center"; ctx.font = med; ctx.fillStyle = primary; - ctx.fillText(data.Character.Title.Name, 665, textTitleY); + + if (data.Character.Title.Name !== undefined) + ctx.fillText(data.Character.Title.Name, 665, textTitleY); + ctx.font = small; ctx.fillText(`${data.Character.Server} (${data.Character.DC})`, 665, textServerY); @@ -296,7 +299,7 @@ class CardCreator { ctx.textAlign = "center"; // Chara Name - if (data.Character.Title.Name == null || data.Character.Title.Name == "") { + if (data.Character.Title === undefined || data.Character.Title.Name == null || data.Character.Title.Name == "") { ctx.fillText(data.Character.Name, 665, textNameNoTitleY); } else { ctx.fillText(data.Character.Name, 665, textNameTitleY);