fix: crash in ssh and trash adapter detail columns (#235)

This commit is contained in:
Steven Arcangeli 2023-11-24 14:13:56 -08:00
parent 05cb8257cb
commit e89a8f8ade
2 changed files with 5 additions and 2 deletions

View file

@ -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)
@ -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)

View file

@ -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