1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Fixed crash when importing images that were failing to load

They still fail to load, but Pixelorama does not crash.
This commit is contained in:
OverloadedOrama 2020-01-25 21:27:54 +02:00
parent 3b289c5772
commit d83057120b
2 changed files with 15 additions and 5 deletions

View file

@ -10,9 +10,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Spanish translation - thanks to azagaya!
- Translators can now be seen in the About window.
## Changed
- Updates to the Greek, Russian and Traditional Chinese translations.
- Replaced some OS alerts with a custom made error dialog.
### Fixed
- Delay the splash screen popup so it shows properly centered (thanks to YeldhamDev)
- Possibly fixed crashes with motion drawing and undo/redoing.
- Fixed bug (which also caused crashes sometimes) when generating an outline inside the image and it was going outside the canvas' borders.
- Fixed crash when importing images that were failing to load. They still fail to load, but Pixelorama does not crash.
## [v0.6.1] - 13-01-2020

View file

@ -35,8 +35,7 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
Global.control.clear_canvases()
var first_path : String = paths[0]
var i: int = Global.canvases.size()
var i : int = Global.canvases.size()
if !import_spritesheet:
# Find the biggest image and let it handle the camera zoom options
var max_size : Vector2
@ -45,7 +44,9 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
var image := Image.new()
var err := image.load(path)
if err != OK: # An error occured
OS.alert("Can't load file")
var file_name : String = path.get_file()
Global.error_dialog.set_text("Can't load file '%s'.\nError code: %s" % [file_name, str(err)])
Global.error_dialog.popup_centered()
continue
var canvas : Canvas = load("res://Prefabs/Canvas.tscn").instance()
@ -69,13 +70,16 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
i += 1
biggest_canvas.camera_zoom()
if biggest_canvas:
biggest_canvas.camera_zoom()
else:
var image := Image.new()
var err := image.load(first_path)
if err != OK: # An error occured
OS.alert("Can't load file")
var file_name : String = first_path.get_file()
Global.error_dialog.set_text("Can't load file '%s'.\nError code: %s" % [file_name, str(err)])
Global.error_dialog.popup_centered()
return
spritesheet_horizontal = min(spritesheet_horizontal, image.get_size().x)