Fix NullPointerException when there isn't an adapter.