Skip to main content
johnrellis
Legend
November 20, 2025
Question

SDK: folder:getParent() raises error instead of returning nil on root folder

  • November 20, 2025
  • 0 replies
  • 31 views

The SDK call folder:getParent() raises the error "?:0: attempt to index field 'parent' (a nil value)" when called on the root folder of some catalogs on Windows -- it should return nil instead. To reproduce on LR 15.0.1 / Windows 11 ARM and Windows 11 Intel:

 

1. Download and uncompress this catalog folder:

https://www.dropbox.com/scl/fi/t1gksh5hw2ov8g48tcca6/folder-getparent-bug.2025-11-20.zip?rlkey=kxqi5d5bx3tqcalrne14fyv2k&dl=0

 

2. Move the file "folder-getparent-bug.lua" from the catalog folder to the LR Scripts folder.

 

3. Start LR and open the catalog.

 

4. In the Scripts menu, invoke "folder-getparent-bug".  Observe this output:

 

When tested on Mac OS 15.7.1, no error occurs:

 

 Note that on Mac, the call to folder:getParent() returns 0 results rather than nil (though in most contexts, there's no difference).