Fixed Java null pointer exceptions upon empty selection