Skip to content

Commit 386974a

Browse files
committed
Fix crash when selected photos were not within a publish service
1 parent e66096a commit 386974a

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

piwigoPublish.lrplugin/PWSetAlbumCover.lua

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,21 @@ local function SetAlbumCover()
5050
local catId = nil
5151
local publishSettings = nil
5252
for s, source in pairs(sources) do
53-
if source:type() == "LrPublishedCollection" or source:type() == "LrPublishedCollectionSet" then
54-
log:info("Source " .. s .. " is " .. source:getName() )
55-
local thisService = source:getService()
56-
local thisSettings = thisService:getPublishSettings()
57-
-- is this publish service using this plugin?
58-
local thisPluginId = thisService:getPluginId()
59-
if thisPluginId == _PLUGIN.id then
60-
useService = thisService
61-
useSource = source
62-
catId = source:getRemoteId()
63-
publishSettings = thisSettings
64-
break
53+
if type(source) == "table" and source.type then
54+
local srcType = source:type()
55+
if srcType == "LrPublishedCollection" or srcType == "LrPublishedCollectionSet" then
56+
log:info("Source " .. s .. " is " .. source:getName() )
57+
local thisService = source:getService()
58+
local thisSettings = thisService:getPublishSettings()
59+
-- is this publish service using this plugin?
60+
local thisPluginId = thisService:getPluginId()
61+
if thisPluginId == _PLUGIN.id then
62+
useService = thisService
63+
useSource = source
64+
catId = source:getRemoteId()
65+
publishSettings = thisSettings
66+
break
67+
end
6568
end
6669
end
6770
end

0 commit comments

Comments
 (0)