NPE when empty language

This commit is contained in:
hieplq 2013-10-01 01:37:02 +07:00
parent 3df36ec2ed
commit d5a839d4a3
1 changed files with 14 additions and 4 deletions

View File

@ -120,7 +120,8 @@ public class LoginPanel extends Window implements EventListener<Event>
protected A btnResetPassword;
protected ConfirmPanel pnlButtons;
protected boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false);
protected String vailidLstLanguage = null;
public LoginPanel(Properties ctx, LoginWindow loginWindow)
{
this.ctx = ctx;
@ -379,6 +380,10 @@ public class LoginPanel extends Window implements EventListener<Event>
btnResetPassword = new A(Msg.getMsg(Language.getBaseAD_Language(), "ForgotMyPassword"));
btnResetPassword.setId("btnResetPassword");
if (lstLanguage.getItems().size() > 0){
vailidLstLanguage = (String)lstLanguage.getItems().get(0).getLabel();
}
}
public void onEvent(Event event)
@ -395,9 +400,14 @@ public class LoginPanel extends Window implements EventListener<Event>
}
else if (event.getName().equals(Events.ON_SELECT))
{
if(eventComp.getId().equals(lstLanguage.getId())) {
String langName = (String) lstLanguage.getSelectedItem().getLabel();
languageChanged(langName);
if(eventComp.getId().equals(lstLanguage.getId())) {
if (lstLanguage.getSelectedItem() == null){
lstLanguage.setValue(vailidLstLanguage);
}else{
vailidLstLanguage = lstLanguage.getSelectedItem().getLabel();
}
languageChanged(vailidLstLanguage);
}
}
else if (event.getTarget() == btnResetPassword)