1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Fixed crash when trying to fill a pattern and no patterns existed

This should not happen in a realistic scenario anyway, but it's now fixed just in case.
This commit is contained in:
OverloadedOrama 2020-04-25 15:00:38 +03:00
parent 7bac0ff8f4
commit 09a8f5f47f

View file

@ -362,7 +362,7 @@ func _input(event : InputEvent) -> void:
horizontal_mirror = Global.right_horizontal_mirror
vertical_mirror = Global.right_vertical_mirror
if fill_with == 1: # Pattern fill
if fill_with == 1 && pattern_image: # Pattern fill
pattern_fill(sprite, mouse_pos, pattern_image, sprite.get_pixelv(mouse_pos), pattern_offset)
if horizontal_mirror:
var pos := Vector2(mirror_x, mouse_pos.y)
@ -391,7 +391,7 @@ func _input(event : InputEvent) -> void:
for yy in range(north_limit, south_limit):
var c : Color = sprite.get_pixel(xx, yy)
if c == pixel_color:
if fill_with == 1: # Pattern fill
if fill_with == 1 && pattern_image: # Pattern fill
pattern_image.lock()
var pattern_size := pattern_image.get_size()
var xxx : int = int(xx + pattern_offset.x) % int(pattern_size.x)