From e6c4a72158f2fa7cecc859c78ba75e372972ecf6 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 22 Nov 2024 20:47:38 +0200 Subject: [PATCH] Fix crash when using indexed mode and the palette has empty swatches between colors --- src/Classes/ImageExtended.gd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Classes/ImageExtended.gd b/src/Classes/ImageExtended.gd index d1555c63d..fac52e123 100644 --- a/src/Classes/ImageExtended.gd +++ b/src/Classes/ImageExtended.gd @@ -74,8 +74,9 @@ func select_palette(_name: String, convert_to_rgb := true) -> void: ## Updates [member palette] to contain the colors of [member current_palette]. func update_palette() -> void: - if palette.size() != current_palette.colors.size(): - palette.resize(current_palette.colors.size()) + if palette.size() != current_palette.colors_max: + palette.resize(current_palette.colors_max) + palette.fill(TRANSPARENT) for i in current_palette.colors: palette[i] = current_palette.colors[i].color