Lightroom SDK (4.1): folder:getPhotos( false ) returning nil.

  • 2
  • Problem
  • Updated 5 years ago
According to the API doc, this should return an empty table if no photos, which it usually (but not always) does. Its possible for the catalog to return a folder object which corresponds to a folder which no longer exists (e.g. it's been renamed, but not all parts of Lightroom got the memo, or something), in which case nil is returned.

I may not have the analysis perfect but get-photos is definitely returning nil sometimes, beware...

Yep, by renaming the folders back to the original names, get-photos no longer returns nil.

Note: it's possible the root of the bug is in catalog:getFolderByPath, since it's returning a folder object to a path which no longer exists, not on disk, and not, theoretically, in the catalog anymore, since it was renamed successfully in Lightroom.

Same problem with folder:getChildren (returns nil).

See related bug: http://feedback.photoshop.com/photosh...

R
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes

Posted 6 years ago

  • 2
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes
Present code for dealing with this:


toAdd = folder:getPhotos( false )
if toAdd ~= nil then -- should always be true, but isn't always.
-- good
else -- I thought this wouldn't happen, but it's happening.
toAdd = {}
app:logWarning( "A folder has probably been renamed recently. Due to a bug in Lightroom, you will probably need to restart Lightroom to clear this condition." )
end
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes
Bug still not fixed @Lr5.0 - just caused a problem for one of my clients.

Adobe: please fix this.