Skip to content

Commit

Permalink
fix: crash in ssh and trash adapter detail columns (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Nov 24, 2023
1 parent 05cb825 commit e89a8f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/oil/adapters/ssh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ local ssh_columns = {}
ssh_columns.permissions = {
render = function(entry, conf)
local meta = entry[FIELD_META]
return permissions.mode_to_str(meta.mode)
return meta and permissions.mode_to_str(meta.mode)
end,

parse = function(line, conf)
Expand Down Expand Up @@ -142,7 +142,7 @@ ssh_columns.permissions = {
ssh_columns.size = {
render = function(entry, conf)
local meta = entry[FIELD_META]
if not meta.size then
if not meta or not meta.size then
return ""
elseif meta.size >= 1e9 then
return string.format("%.1fG", meta.size / 1e9)
Expand Down
3 changes: 3 additions & 0 deletions lua/oil/adapters/trash/freedesktop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ end)
file_columns.mtime = {
render = function(entry, conf)
local meta = entry[FIELD_META]
if not meta then
return nil
end
---@type oil.TrashInfo
local trash_info = meta.trash_info
local time = trash_info and trash_info.deletion_date or meta.stat and meta.stat.mtime.sec
Expand Down

0 comments on commit e89a8f8

Please sign in to comment.