From 512507e2c7842697cca75652be49fc7d7ae91f87 Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 26 Nov 2020 01:22:11 +0200 Subject: [PATCH] Fix "It's not a reference to a valid Image object" error when resizing canvas for the first time --- src/UI/Dialogs/ImageEffects/ResizeCanvas.gd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UI/Dialogs/ImageEffects/ResizeCanvas.gd b/src/UI/Dialogs/ImageEffects/ResizeCanvas.gd index b0496f652..3b53063ec 100644 --- a/src/UI/Dialogs/ImageEffects/ResizeCanvas.gd +++ b/src/UI/Dialogs/ImageEffects/ResizeCanvas.gd @@ -16,10 +16,6 @@ onready var preview_rect : TextureRect = $VBoxContainer/Preview func _on_ResizeCanvas_about_to_show() -> void: - if first_time: - width_spinbox.value = Global.current_project.size.x - height_spinbox.value = Global.current_project.size.y - image = Image.new() image.create(Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8) image.lock() @@ -39,7 +35,11 @@ func _on_ResizeCanvas_about_to_show() -> void: layer_i += 1 image.unlock() - update_preview() + if first_time: + width_spinbox.value = Global.current_project.size.x + height_spinbox.value = Global.current_project.size.y + else: + update_preview() func _on_ResizeCanvas_confirmed() -> void: