Fixed your incomplete for loop causing a null pointer exception.