Tableview onRowRender, getting "attempt to call method 'insert' (a nil value)"

Doing lazy loading of images to tableView rows. Code, lines 168-170

                if not row then print(“ROW IS NIL!!”) end
                if not img then print(“IMG IS NIL!!”) end
                row:insert(img)

Log output:

Apr 27 11:23:35 Henriks-iPhone-4 wifid[15] <Notice>: WiFi:[451819415.653117]: Completed Apple80211ScanAsync on en0 (0)
Apr 27 11:23:35 Henriks-iPhone-4 wifid[15] <Notice>: WiFi:[451819415.654330]: Async scan request completed for “locationd” (0)
Apr 27 11:23:35 Henriks-iPhone-4 ShoppingTranas[1340] <Warning>: Runtime error
        /Users/henrikerlandsson/Documents/CORONA-APPAR/TranasHandel/view1.lua:170: attempt to call method ‘insert’ (a nil value)
    stack traceback:
        [C]: in function ‘insert’
        /Users/henrikerlandsson/Documents/CORONA-APPAR/TranasHandel/view1.lua:170: in function ‘onRowRender’

Images are then obviously created but not inserted into the row, so that I get a stack of images covering the tableView.

It happens far from every time. For users, it happens once in a week of use. I have to scroll the tableView like a crazy person to provoke the error. If I were to venture a guess, it would have to do with memory handling/GC. But the fileListener passes a valid event, the row is valid and the image is valid.

Using the [parent] parameter when creating the display object so that you can omit the insert() fixes it on both Iphone and Android. That’s the only change I made. Unexpected. But I’m happy :slight_smile: I’ve filed bug # 40444.

Using the [parent] parameter when creating the display object so that you can omit the insert() fixes it on both Iphone and Android. That’s the only change I made. Unexpected. But I’m happy :slight_smile: I’ve filed bug # 40444.