@@ -164,8 +164,8 @@ file_columns.mtime = {
164
164
165
165
get_sort_value = function (entry )
166
166
local meta = entry [FIELD_META ]
167
- --- @type oil.WindowsTrashInfo
168
- local trash_info = meta .trash_info
167
+ --- @type nil | oil.WindowsTrashInfo
168
+ local trash_info = meta and meta .trash_info
169
169
if trash_info and trash_info .deletion_date then
170
170
return trash_info .deletion_date
171
171
else
@@ -199,7 +199,7 @@ M.filter_action = function(action)
199
199
elseif action .type == " delete" then
200
200
local entry = assert (cache .get_entry_by_url (action .url ))
201
201
local meta = entry [FIELD_META ]
202
- return meta .trash_info ~= nil
202
+ return meta ~= nil and meta .trash_info ~= nil
203
203
elseif action .type == " move" then
204
204
local src_adapter = assert (config .get_adapter_by_scheme (action .src_url ))
205
205
local dest_adapter = assert (config .get_adapter_by_scheme (action .dest_url ))
235
235
M .get_entry_path = function (url , entry , cb )
236
236
local internal_entry = assert (cache .get_entry_by_id (entry .id ))
237
237
local meta = internal_entry [FIELD_META ] --[[ @as {stat: uv_fs_t, trash_info: oil.WindowsTrashInfo, display_name: string}]]
238
- local trash_info = meta .trash_info
238
+ local trash_info = meta and meta .trash_info
239
239
if not trash_info then
240
240
-- This is a subpath in the trash
241
241
M .normalize_url (url , cb )
@@ -265,7 +265,7 @@ M.render_action = function(action)
265
265
local entry = assert (cache .get_entry_by_url (action .url ))
266
266
local meta = entry [FIELD_META ]
267
267
--- @type oil.WindowsTrashInfo
268
- local trash_info = meta .trash_info
268
+ local trash_info = meta and meta .trash_info
269
269
local short_path = fs .shorten_path (trash_info .original_path )
270
270
return string.format (" PURGE %s" , short_path )
271
271
elseif action .type == " move" then
@@ -348,7 +348,7 @@ M.perform_action = function(action, cb)
348
348
if action .type == " delete" then
349
349
local entry = assert (cache .get_entry_by_url (action .url ))
350
350
local meta = entry [FIELD_META ] --[[ @as {stat: uv_fs_t, trash_info: oil.WindowsTrashInfo, display_name: string}]]
351
- local trash_info = meta .trash_info
351
+ local trash_info = meta and meta .trash_info
352
352
353
353
purge (trash_info , cb )
354
354
elseif action .type == " move" then
@@ -364,7 +364,7 @@ M.perform_action = function(action, cb)
364
364
dest_path = fs .posix_to_os_path (dest_path )
365
365
local entry = assert (cache .get_entry_by_url (action .src_url ))
366
366
local meta = entry [FIELD_META ] --[[ @as {stat: uv_fs_t, trash_info: oil.WindowsTrashInfo, display_name: string}]]
367
- local trash_info = meta .trash_info
367
+ local trash_info = meta and meta .trash_info
368
368
fs .recursive_move (action .entry_type , trash_info .trash_file , dest_path , function (err )
369
369
if err then
370
370
return cb (err )
@@ -388,7 +388,7 @@ M.perform_action = function(action, cb)
388
388
dest_path = fs .posix_to_os_path (dest_path )
389
389
local entry = assert (cache .get_entry_by_url (action .src_url ))
390
390
local meta = entry [FIELD_META ] --[[ @as {stat: uv_fs_t, trash_info: oil.WindowsTrashInfo, display_name: string}]]
391
- local trash_info = meta .trash_info
391
+ local trash_info = meta and meta .trash_info
392
392
fs .recursive_copy (action .entry_type , trash_info .trash_file , dest_path , cb )
393
393
else
394
394
error (" Must be moving files into or out of trash" )
0 commit comments