Fix accidentally deleted first image during import. Lua is very picky about sparse table handling.

This commit is contained in:
Christian Mandel
2016-04-27 17:18:41 +02:00
parent 22d7107305
commit 4397e07d7f

View File

@@ -50,6 +50,7 @@ dt.register_import_filter("prefer raw over jpeg", function(event, images)
local current_base = ""
local jpg_indices = {}
local other_format_found = false
local last_index
table.insert(images, "")
for i, img in ipairs(images) do
local extension = img:match("[^.]*$"):upper()
@@ -74,8 +75,9 @@ dt.register_import_filter("prefer raw over jpeg", function(event, images)
other_format_found = true
end
last_index = i
end
table.remove(images)
images[last_index] = nil
end)
-- vim: shiftwidth=2 expandtab tabstop=2 cindent