From dfff192e71009d3375674393430cead700fd3ba0 Mon Sep 17 00:00:00 2001 From: Nintbros <135995010+Nintbros@users.noreply.github.com> Date: Mon, 16 Oct 2023 21:11:11 +0200 Subject: [PATCH] fix _slice9 == [] (#256) * fix _slice9 == [] [] == [] is false, because arrays i simply changed `_slice9 == []` to `_slice9.length != 4` which would achieve the intended purpose, i think * warn if given invalid 9slice array how can you do this with only 1 conditional again * Update flixel/addons/ui/FlxUI9SliceSprite.hx Co-authored-by: George Kurelic --------- Co-authored-by: George Kurelic --- flixel/addons/ui/FlxUI9SliceSprite.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flixel/addons/ui/FlxUI9SliceSprite.hx b/flixel/addons/ui/FlxUI9SliceSprite.hx index 9a517f0..8731317 100644 --- a/flixel/addons/ui/FlxUI9SliceSprite.hx +++ b/flixel/addons/ui/FlxUI9SliceSprite.hx @@ -158,8 +158,10 @@ class FlxUI9SliceSprite extends FlxUISprite implements IResizable implements IFl var iw = Std.int(pt.x); var ih = Std.int(pt.y); - if (_slice9 == null || _slice9 == []) + if (_slice9 == null || _slice9.length != 4) { + if (_slice9 != null) + flixel.FlxG.log.warn("Invalid 9slice array, expected a length of 4"); _slice9 = [4, 4, 7, 7]; }