Add null checks for entry and mainWindow and throw exception when needed. Also there is a misplaced space around the comma (,)