Here, there is an obvious bug, it should be if != and not == else there will be a NPE on the next line