fix: crash in ssh and trash adapter detail columns (#235)
This commit is contained in:
parent
05cb8257cb
commit
e89a8f8ade
2 changed files with 5 additions and 2 deletions
|
|
@ -109,7 +109,7 @@ local ssh_columns = {}
|
||||||
ssh_columns.permissions = {
|
ssh_columns.permissions = {
|
||||||
render = function(entry, conf)
|
render = function(entry, conf)
|
||||||
local meta = entry[FIELD_META]
|
local meta = entry[FIELD_META]
|
||||||
return permissions.mode_to_str(meta.mode)
|
return meta and permissions.mode_to_str(meta.mode)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
parse = function(line, conf)
|
parse = function(line, conf)
|
||||||
|
|
@ -142,7 +142,7 @@ ssh_columns.permissions = {
|
||||||
ssh_columns.size = {
|
ssh_columns.size = {
|
||||||
render = function(entry, conf)
|
render = function(entry, conf)
|
||||||
local meta = entry[FIELD_META]
|
local meta = entry[FIELD_META]
|
||||||
if not meta.size then
|
if not meta or not meta.size then
|
||||||
return ""
|
return ""
|
||||||
elseif meta.size >= 1e9 then
|
elseif meta.size >= 1e9 then
|
||||||
return string.format("%.1fG", meta.size / 1e9)
|
return string.format("%.1fG", meta.size / 1e9)
|
||||||
|
|
|
||||||
|
|
@ -348,6 +348,9 @@ end)
|
||||||
file_columns.mtime = {
|
file_columns.mtime = {
|
||||||
render = function(entry, conf)
|
render = function(entry, conf)
|
||||||
local meta = entry[FIELD_META]
|
local meta = entry[FIELD_META]
|
||||||
|
if not meta then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
---@type oil.TrashInfo
|
---@type oil.TrashInfo
|
||||||
local trash_info = meta.trash_info
|
local trash_info = meta.trash_info
|
||||||
local time = trash_info and trash_info.deletion_date or meta.stat and meta.stat.mtime.sec
|
local time = trash_info and trash_info.deletion_date or meta.stat and meta.stat.mtime.sec
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue