The code in your screenshots is quite hard to read, so please post code snippets by wrapping them into three backticks ```, as it’s easier to read/debug, and the search engine would be able to index it as well if other users hit similar issues.
Based on what I can see it seems that a local variable is references before its assignment, so you would need to check where its definition is.