Fix null pointer crash in BT renaming dialog

The dialog may become null after onDestroy has been invoked, so
we need to catch this case.

This CL also moves the listener outside to make it easy to test.

Change-Id: I4ce640c5bdaf1f201f9fecb14b3e5e38e10d4b79
Fixes: 115679393
Test: RunSettingsRoboTests
2 files changed