fix null error in GroupTools

This commit is contained in:
2022-08-12 14:58:45 +00:00
parent 9321ecb9ec
commit 41140798b8

View File

@@ -18,8 +18,8 @@
(function :FlxRect calculateScreenBounds <>[:FlxSprite T] [:FlxTypedGroup<T> group &opt :FlxCamera camera :Float margin] (function :FlxRect calculateScreenBounds <>[:FlxSprite T] [:FlxTypedGroup<T> group &opt :FlxCamera camera :Float margin]
(unless margin (set margin 0)) (unless margin (set margin 0))
(let [s (group.getFirstAlive) (ifLet [s (group.getFirstAlive)]
r (new FlxRect) (let [r (new FlxRect)
bounds (s.getScreenBounds r camera) bounds (s.getScreenBounds r camera)
&mut minX bounds.left &mut minX bounds.left
&mut maxX bounds.right &mut maxX bounds.right
@@ -35,4 +35,5 @@
(r.fromTwoPoints (r.fromTwoPoints
(new FlxPoint (- minX margin) (- minY margin)) (new FlxPoint (- minX margin) (- minY margin))
(new FlxPoint (+ maxX margin) (+ maxY margin))))) (new FlxPoint (+ maxX margin) (+ maxY margin))))
(new FlxRect 0 0 0 0)))