Skip to content

Commit

Permalink
Fix guards
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbomber committed Nov 9, 2024
1 parent 24f4667 commit 4f673e0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugin/src/App/getTextBoundsAsync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4f673e0

Please sign in to comment.