Add null check to getSelectedCharacter