Fix NPE when opening a dialog with a selected item after rotate the phone