Runtime Error caused by Widget.lua

That error appears to be a case of trying to insert a row into a tableView that doesn’t exist, or is in the process of being removed, i.e. the parent object is nil. 

Could this be happening?

Rob

Hi Rob

I do check that the row is valid before attempting to access it so I am not too sure on that.  I do the followiing

local function onRowRender( event ) local row = event.row if isDisplayObject(row) then \<build the row now\> end end

The check funciton is

function isDisplayObject(obj) --check for a valid display object if obj ~= nil then if type( obj.removeSelf ) == "function" then return true else return false end else return false end end

So I would hope that would be hardened enough?

It’s happening when you call tableView:insertRow() not during the row’s rendering step.

Rob

Ah I see… what is the best way to check that **tableView:insertRow() **is a valid operation?

I would imagine it is happening on slow internet connections as the data is being pulled from my MySQL servers.

I think that’s where we need to harden that API call, but you probably could test to see if the tableView exists before you try and call insertRow().

Rob

That’s the thing, I do check and it is valid. 

Otherwise it would raise an error… something like “attempt to index field ‘insertRow’ (a nil value)

I’m sure others would appreciate some hardening on the API here as I am sure I’m not the only one filling content from an external source.

That’s what I was seeing, I tested everything in my own code to absolutely make sure it wasn’t nil, that it was a display object, that insertRow existed, but still 1 in maybe 1000 times this runtime error would occur. It was almost as if the tableView was in an invalid state, halfway towards being deleted.

In the end I just had to download the Widget library and put extra nil checks all over the place, but especially where I had seen errors come through on the logs. 

We think we fixed this tableView:insertRow() issue in daily build 2018.3301. Can you give it a try?

Rob

@Rob wow that was fast!  I will try 3301 and see if that helps.

Really great turnaround on this one… I’m impressed.

@Rob, thank you - I’ll create the next update with this version!

We haven’t seen a widget.lua crash occur yet in our recent update. Crossing our fingers that it’s fixed. :slight_smile: