Skip to content

Commit

Permalink
TextFormat: check for null in fromSimpleTextFormat()
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Oct 24, 2024
1 parent 48a7660 commit 3e277af
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/feathers/text/TextFormat.hx
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ abstract AbstractTextFormat(TextFormat) from TextFormat to TextFormat {
**/
@:from
public static function fromSimpleTextFormat(textFormat:openfl.text.TextFormat):AbstractTextFormat {
if (textFormat == null) {
return null;
}
var clone = new TextFormat(textFormat.font, textFormat.size, textFormat.color, textFormat.bold, textFormat.italic, textFormat.underline,
textFormat.url, textFormat.target, textFormat.align, textFormat.leftMargin, textFormat.rightMargin, textFormat.indent, textFormat.leading);
clone.blockIndent = textFormat.blockIndent;
Expand Down

0 comments on commit 3e277af

Please sign in to comment.