From 4f673e01cd6f6ef298a49a9b2338667b68fca507 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Fri, 8 Nov 2024 18:21:06 -0800 Subject: [PATCH] Fix guards --- plugin/src/App/getTextBoundsAsync.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/src/App/getTextBoundsAsync.lua b/plugin/src/App/getTextBoundsAsync.lua index 12c394bf8..2813903e6 100644 --- a/plugin/src/App/getTextBoundsAsync.lua +++ b/plugin/src/App/getTextBoundsAsync.lua @@ -14,8 +14,12 @@ local function getTextBoundsAsync( width: number, richText: boolean? ): Vector2 - if type(text) ~= "string" or #text > 200_000 then - Log.warn(`Invalid text: {text}`) + if type(text) ~= "string" then + Log.warn(`Invalid text. Expected string, received {type(text)} instead`) + return Vector2.zero + end + if #text >= 200_000 then + Log.warn(`Invalid text. Exceeds the 199,999 character limit`) return Vector2.zero end