Error while trying to hide a text render

When the cast fails, it means the object isn’t there or it’s another, undesired object type. And you still try to access it, hence the error.