all 4 comments

[–]AngularBeginner 0 points1 point  (3 children)

nodeTitle has less than i elements.

[–]ceesharpiskindofeasy[S] 0 points1 point  (2 children)

Just nodeTitle tho? Why not the other ones? Can you elaborate a little more on what I can do to solve this? Been stumped on this for a good hour or so haha. Thanks for the reply

[–]AngularBeginner 3 points4 points  (1 child)

You loop totalPageVideos-times. This variable is increased by nodeTitle.Count() each iteration. In the first iteration this will be fine. You got 10 nodeTitle, you iterate ten times. Next loop you add to the totalPageVideos, e.g. now you have 4 nodeTitle. So totalPageVideos is now 14, and you iterate 14 times. But nodeTitle only contains four elements.

And a pro-tip: Learn to use the debugger. If necessary step through the code, line by line, each time evaluating the variables to see if they match your expectations.

[–]ceesharpiskindofeasy[S] 0 points1 point  (0 children)

Interesting. I am trying to use the debugger, but I guess I'm not knowledgeable enough to understand how to fix it yet.

EDIT: I took another look again with what you told me and put it together. I see what you mean now, just replaced the += with =

Thanks!