BufferedReader.readLine can return null, deal with it gracefully.