Skip to content

Commit

Permalink
fix: don't continue if there are 0 files
Browse files Browse the repository at this point in the history
chore: add comment for open signal
  • Loading branch information
GeopJr committed Nov 1, 2022
1 parent 21a7e95 commit fe1b9f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/collision/views/main.cr
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,14 @@ module Collision
TOOL_VERIFY_OVERLAY.child = scrolled_window
end

# Handles the open signal. It first calls activate and then
# if there are files passed (that exist and are not dirs)
# it sets the first one (since multiple can be passed)
# as the Collision::Welcomer's file.
def open_with(app : Adw::Application, files : Enumerable(Gio::File), hint : String)
activate(app)

if files.size >= 0 && Collision.file?(files[0].path.not_nil!, false)
if files.size > 0 && Collision.file?(files[0].path.not_nil!, false)
Collision::Welcomer.file = files[0]
end

Expand Down

0 comments on commit fe1b9f2

Please sign in to comment.