TableView error question

On my current project I am using a TableView that, when selected, loads a scrollview. Periodically when scrolling the TableView I get the following Runtime Error:

[lua]

03-22 19:32:11.584 27913 27926 I Corona  : ERROR: Runtime error

03-22 19:32:11.584 27913 27926 I Corona  : /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/widget/widgetLibrary/widget_tableview.lua:389: attempt to index field ‘_view’ (a nil value)

03-22 19:32:11.584 27913 27926 I Corona  : stack traceback:

03-22 19:32:11.584 27913 27926 I Corona  :      /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/widget/widgetLibrary/widget_tableview.lua:389: in function ‘touch’

03-22 19:32:11.584 27913 27926 I Corona  :      /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/widget/widgetLibrary/widget_tableview.lua:952: in function ‘func’

03-22 19:32:11.584 27913 27926 I Corona  :      /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:222: in function </Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:205>

[/lua]

The error will usually appear in the log several times in a row. The TV is in motion when this error pops up which leads me to believe that each block of errors like the above is related to each row of the TV that is causing the issue. I haven’t been able to determine the steps that cause this error, it periodically just pops up when noodling around with the TV. The error suggests that there is a row in the TV that is missing an index that is uncovered on a ‘touch’ event but I don’t know how to test the code referenced in the error. So, my question is: how do I troubleshoot widget_tableview.lua?

Details:

-The error occurs on several builds I have tried, including the most recent daily build 2016.2844

-The error only occurs on a device, not in the simulator

-I have not tested on an Apple device yet

-Device shown in the video is a Nexus 6 with Android 6.0.1

-Also have encountered the issue with a Galaxy Nexus running Android 4.2.2

-The error will occur every time if I play around with the TV long enough

-I’ve seen some posts related to other “jenkins” errors. The only solution that I’ve seen that possibly relates has to do with disabling plugins, which I am trying once I finish this post. I use 1 currently: the Admob plugin.

Below I have included a link to a screen capture video showing the problem (jump to 2:30 to get straight to the Runtime Error). The error occurs while moving the TV up and down, not when selecting a TV row.

https://youtu.be/dyIkMVKmhao

Thank you to all that take a look at this!

Ed

UPDATE:

After flicking the TableView up and down a bit in the simulator, I have been able to recreate a very similar Runtime Error:

[lua]10:28:55.169 ERROR: Runtime error
10:28:55.169 ?:0: attempt to index field ‘_view’ (a nil value)
10:28:55.169 stack traceback:
10:28:55.169 ?: in function ‘touch’
10:28:55.169 ?: in function
10:28:55.169 ?: in function [/lua]

Anyone, any thoughts where I can start to track this down??

Thank you!

UPDATE 2:

I added a print statement to onRowTouch that prints event.target.index if phase == “press”. The print statement indicates that the row index is 12, yet the error message indicates that a nil value was passed. Anyway, here is the simulator output screen (ORT is print statement within onRowTouch and TVL is print statement in tableViewListener):

[lua]10:47:43.233 ORT: press
10:47:43.233 ORT: press
10:47:43.233 Pressed row: 12
10:47:43.233 ID: 416072
10:47:43.263 TVL Phase: began
10:47:43.263 TVL Content Pos: -1590.9401855469
10:47:43.263 TVL Phase: began
10:47:43.263 TVL Content Pos: -1590.9401855469
10:47:43.273 ERROR: Runtime error
10:47:43.273 ?:0: attempt to index field ‘_view’ (a nil value)
10:47:43.273 stack traceback:
10:47:43.273 ?: in function ‘touch’
10:47:43.273 ?: in function
10:47:43.273 ?: in function [/lua]

Here is onRowTouch:

[lua]local onRowTouch = function(event)
local phase = event.phase
print ("ORT: " … phase)
if (phase == “press”) then
print ("ORT: " … phase)
print("Pressed row: ", event.target.index)
print("ID: ", event.target.id)
end
if (phase == “tap”) then
print ("ORT: " … phase)
print("Tapped row: ", event.target.index)
print("ID: ", event.target.id)
end
if (phase == “release”) then
print("Released row: ", event.target.index)
print("ID: ", event.target.id)
if(event.target.index % 2 == 0) then
– hide the calendar selection button
_G.GUI.GetHandle(“MY_BUTTON”):show(false)
– get the current screen ratio
Globals.TVRatio = display.contentHeight / display.contentWidth
– 3 steps: destory the tableView
Globals.tableView:deleteAllRows()
display.remove( Globals.tableView )
–Globals.tableView:removeSelf()
Globals.tableView = nil
– unhide back button
Globals.btnBack.alpha = 1
– hide app name
Globals.appName.alpha = 0

– create the away/home buttons
Z.createAwayHome( event )

else
print(“Nothing to do here, this tap must be on a header.”)
end
end – end if phase == “release”
return true
end – end local function
Z.onRowTouch = onRowTouch[/lua]

Link to a screen capture of the above error message:

https://youtu.be/hVw6fZrkJ8k

Thank you! 

Ed

P.S. is there a way to post code to main indenting?

Hi @reallyrottens_98,

At an initial glance, shouldn’t your conditional phase checks inside the “onRowTouch()” function be structured in the following format to avoid potential duplicate responses?

if then elseif then elseif then (else) end

Here, you have it:

if then end if then end if then end

I would suggest doing the first one, unless you have a very specific reasoning for using the conditional setup where you may get multiple true conditions.

Brent

Hi Brent,

Thank you for the response!

I put in the multiple if’s while trying different ways to troubleshoot this - I was checking to see if perhaps multiple touch/tap/other phases were somehow being fired simultaneously. I had not cleaned it up yet. The things you do when you start running out of ideas!

I added some code to print the event table and subtables right before the Runtime Error. Here is the output:

[lua]16:46:13.013 ORT: press

16:46:13.013 table: 0A981C10 {
16:46:13.013 [phase] => “press”
16:46:13.013 [row] => table: 0A981C10 {
16:46:13.013 [index] => 4
16:46:13.013 [_label] => “”
16:46:13.013 [id] => “416077”
16:46:13.013 [_cannotTap] => false
16:46:13.013 [setRowColor] => function: 0A71D798
16:46:13.013 [isCategory] => false
16:46:13.013 [_functionListeners] => table: 0A8EFC48 {
16:46:13.013 [tap] => table: 0A8ECA48 {
16:46:13.013 [1] => function: 0A97AA00
16:46:13.013 }
16:46:13.013 [touch] => table: 0A8ECA48 {
16:46:13.013 [1] => function: 0A97A9E0
16:46:13.013 }
16:46:13.013 }
16:46:13.013 [_class] => table: 0A8EFC48 {
16:46:13.013 [removeEventListener] => function: 0699EB80
16:46:13.013 [addEventListener] => function: 0699EB60
16:46:13.013 [__index] => table: 0699FCF0 {
16:46:13.013 *table: 0699FCF0
16:46:13.013 }
16:46:13.013 }
16:46:13.013 [params] => table: 0A8EFC48 {
16:46:13.013 [home_team_id] => “144”
16:46:13.013 [away_probable_pitcher_first] => “Lance”
16:46:13.013 [away_team_id] => “138”
16:46:13.013 [home_team_city] => “Atlanta”
16:46:13.013 [away_probable_pitcher_losses] => “10”
16:46:13.013 [away_team_city] => “STL C”
16:46:13.013 [home_probable_pitcher_losses] => “8”
16:46:13.013 [home_probable_pitcher_wins] => “7”
16:46:13.013 [away_probable_pitcher_era] => “3.06”
16:46:13.013 [home_probable_pitcher_era] => “5.11”
16:46:13.013 [away_probable_pitcher_wins] => “12”
16:46:13.013 [home_probable_pitcher_last] => “Wisler”
16:46:13.013 [away_probable_pitcher_id] => “458681”
16:46:13.013 [away_probable_pitcher_last] => “Lynn”
16:46:13.013 [home_probable_pitcher_first] => “Matt”
16:46:13.013 [home_probable_pitcher_id] => “605538”
16:46:13.013 }
16:46:13.013 [removeSelf] => function: 0A71D738
16:46:13.013 [_rowColor] => table: 0A8EFC48 {
16:46:13.013 [default] => table: 0ACE14C8 {
16:46:13.013 [1] => 1
16:46:13.013 [2] => 1
16:46:13.013 [3] => 1
16:46:13.013 }
16:46:13.013 [over] => table: 0ACE14C8 {
16:46:13.013 [1] => 0.89411764705882
16:46:13.013 [2] => 0.89411764705882
16:46:13.013 [3] => 0.89411764705882
16:46:13.013 }
16:46:13.013 }
16:46:13.013 [_proxy] => userdata: 0A8EFA30
16:46:13.013 [_cell] => table: 0A8EFC48 {
16:46:13.013 [_class] => table: 0A8ECB60 {
16:46:13.013 *table: 0699FCF0
16:46:13.013 }
16:46:13.013 [_proxy] => userdata: 0A8EFBE8
16:46:13.013 }
16:46:13.013 [_separator] => table: 0A8EFC48 {
16:46:13.013 [_class] => table: 0A8ECB10 {
16:46:13.013 *table: 0699FCF0
16:46:13.013 }
16:46:13.013 [_proxy] => userdata: 0A8ECB50
16:46:13.013 }
16:46:13.013 }
16:46:13.013 [target] => table: 0A981C10 {
16:46:13.013 *table: 0A8EFC48
16:46:13.013 }
16:46:13.013 }
16:46:13.013 ORT: press
16:46:13.013 Pressed row: 4
16:46:13.013 ID: 416077
16:46:13.063 ERROR: Runtime error
16:46:13.063 ?:0: attempt to index field ‘_view’ (a nil value)
16:46:13.063 stack traceback:
16:46:13.063 ?: in function ‘touch’
16:46:13.063 ?: in function
16:46:13.063 ?: in function [/lua]

Again, thank you for looking at this!

Ed

Can you post the code that shows the actual creation of the TableView?

Brent,

I will gladly post my creation code, but first I wanted to share some additional info I’ve discovered about this issue. (I used the Widget Demo code as a template for the creation of the TableView.)

The TableView will generate this Runtime Error when a row is partially off the top of the screen and then the user attempts to scroll the TableView by pressing on the partially exposed row and scrolling the TableView. Here is an example of the error occurring on the Widget Demo code included with the Corona SDK simulator:

https://youtu.be/4ujFHOqUczo

Please advise on how I should proceed ( do you want me to post my tableView creation code? ).

Thank you!

Ed

Brent,

I submitted a bug report on this issue. The system did not provide an id for the submission, is there a way to track it?

Thank you!

Hi,

Can you carefully check your spam email folder to make sure it didn’t get allocated there?

Thanks,

Brent

Checked Inbox, Spam, Trash. Nowhere to be found.

Brent,

Should I re-submit the Bug Report? I still have not received a notification.

Ed

It looks like your bug failed to submit. There is nothing in the bug tracker with your email address other than an account renewal case from 2014.  Try it again and capture the screen after you press the submit button for me and post it here. And to verify you used an email that starts with reallyrottens_98@

Thanks

Rob

Submitted again with this email.

Hmmm, I still don’t see it in the bug tracker and the result screen looks perfectly normal. I’ll have to hit up engineering on this and see what’s happening.

In the mean time, if you could share your .zip file with me and the text you used for the bug report, I can try and file it for you.

Rob

Bug Title: Table View scroll bug

Bug Description: The TableView will generate this Runtime Error when a row is partially off the top of the screen and then the user attempts to scroll the TableView by pressing on the partially exposed row and scrolling the TableView up. Here is an example of the error occurring on the Widget Demo code included with the Corona SDK simulator:

https://youtu.be/4ujFHOqUczo

Steps to Reproduce: Launch the Widget demo code. With the Table View selected on the bottom tab, scroll down to about row 15 (don’t scroll down so far that the category row is pinned to the top). Scroll up by pulling down on a partially exposed row at the top of the Table View. If the row is mostly exposed the error does not occur, but if less than half of the row is exposed the Runtime error will pop. See the video link:

https://youtu.be/4ujFHOqUczo

Platforms Affected:

Android 5.x

Android 6.x

Corona Windows Simulator

Corona Mac Simulator

Corona Version:  2016.2844

The steps I used to submit the bug report (Chrome): I opened a new tab, typed coronalabs.com into the address bar, selected ‘Forums’ from the ‘Community’ drop down, clicked on ‘Report a bug’ at the top of the page, and then submitted the report (which evidently did not make it to you). The system did not ever ask me to login as I was already logged in on another tab. Hope that helps!

Ed

Case #45528

Thank you Rob!

Sorry if I am missing the obvious, but I can’t find the location on the website where I can track this bug with the case number. Could you point me to the page if it exists?

Thank you, again!

Ed

The bug tracker is internal only.

Rob

Any idea what kind of time frame might be involved in getting this resolved? Days? Weeks? Months? 

I’m not looking for an answer that I can use later to be a jerk about, just a guesstimate so I can work around this for the time being.

‘Absolutely No Idea’ is fine if it fits this problem as well.

Thank you Rob!

Ed

It’s hard to tell. It won’t be “days”. I would say weeks or longer.  If you can work around it, I would.

Rob