Do you get the error on this specific line?
I can't see such problem here and there is no reason it should bring up such error.
I guess this must be something specific in your project. Check if this also happens when you start a new project and the compare what you do special in your project.