/t5/lightroom-classic-bugs/p-sdk-folder-getchildren-incorrectly-returning-0-return-values/idi-p/12251848Nov 18, 2014
Nov 18, 2014
Copy link to clipboard
Copied
On one of my catalogs, folder:getChildren() is returning 0 return values for a particular folder (that is, it is executing a "return;" statement, with no value): I've optimized the catalog to no effect.
If I hide the root folder "/", then the method works correctly.
/t5/lightroom-classic-bugs/p-sdk-folder-getchildren-incorrectly-returning-0-return-values/idc-p/12265330#M5520Nov 18, 2014
Nov 18, 2014
Copy link to clipboard
Copied
I couldn't reproduce this problem. I actually did think I saw the behavior once, but then I could not reproduce so I think I may have just had a bug in my test code.
Can you try breaking out the calls into multiple lines like this:
local root = catalog:getFolders()[1]
local rootName = root:getName()
local subFolder = root:getChildren()[1]
local subFolderName = subFolder:getName()
local subSubFolder = subFolder:getChildren()[1]
local subSubFolderName = subSubFolder:getName()
and let me know if you still are seeing an issue...?
/t5/lightroom-classic-bugs/p-sdk-folder-getchildren-incorrectly-returning-0-return-values/idc-p/12265327#M5519Nov 18, 2014
Nov 18, 2014
Copy link to clipboard
Copied
With the root folder "/" showing, the expression subFolder:getChildren()[1] gets "attempt to index a nil value". Here's the log from my debugger session showing each of the assignments and resulting value: